# Quick Start

## 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 %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hyphen.at/ios/quick-start.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
