> For the complete documentation index, see [llms.txt](https://docs.hyphen.at/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hyphen.at/ios/quick-start.md).

# Quick Start

Start by Using Hyphen iOS SDK

## Create an App in the Dashboard

You need to create an app in the [Hyphen Dashboard](https://hyphen.at/dashboard/new) before using Hyphen SDK. After creating an app, an app secret will be issued. The app secret is required to initialize the SDK.

## Install the SDK using SPM

We recommend Swift Package Manager to install our SDK.

{% tabs %}
{% tab title="Swift" %}
Edit `Package.swift` of your project to add Hyphen SDK.

```swift
import PackageDescription

let package = Package(
    name: "my-project",
    dependencies: [
        .package(url: "https://github.com/hyphen-at/hyphen-ios-sdk.git"),
        ...
    ],
    targets: [...]
)
```

{% endtab %}

{% tab title="Using Xcode" %}

1. In Xcode, Open `.xcodeproj` file of your project.
2. Go to *Package Dependencies*.
3. Click + button below to add a dependency.
4. Enter **`https://github.com/hyphen-at/hyphen-ios-sdk.git`** URL.
5. Click "*Add Package*".
   {% endtab %}
   {% endtabs %}

## Configuring the SDK

On `AppDelegate.swift` of your application, insert the following initialization code.

{% tabs %}
{% tab title="Swift" %}

```swift
import FirebaseMessaging
import HyphenAuthenticate
import HyphenCore
import HyphenUI
import UIKit
import UserNotifications

@main
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {
    func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
    ) -> Bool {
        // initializes Hyphen SDK.
        Hyphen.shared.appSecret = "<INSERT-YOUR-SECRET-HERE>"
        Hyphen.shared.network = .flowTestnet // or flowMainNet
        HyphenAuthenticateAppDelegate.shared.application(application)
        HyphenUI.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
    }

    /// Updates the push token for Hyphen 2FA.
    func application(_: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
        Hyphen.shared.apnsToken = deviceToken
    }
    
    /// Handles the Hyphen 2FA silent push.
    func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any]) async -> UIBackgroundFetchResult {
        await Hyphen.shared.application(application, didReceiveRemoteNotification: userInfo)

        return .newData
    }
    
    /// Handles the Hyphen 2FA notification. 
    func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse) async {
        await Hyphen.shared.userNotificationCenter(center, didReceive: response)
    }
    
    /// Handle when the app is opened through the 2FA notification
    func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
        HyphenAuthenticateAppDelegate.shared.application(app, open: url, options: options)
    }
}
```

{% endtab %}

{% tab title="Objective-C" %}
*Sorry, the example is not provided yet.*

{% endtab %}
{% endtabs %}
