Hyphen
  • Hyphen
  • Concepts
    • Auth Methods
    • Hyphen Multi-Sig Account
      • Device Key
      • Recovery Key
      • Server Key
    • Paymaster
    • Hybrid Custody
  • Mechanism Paper
  • iOS SDK
    • Quick Start
    • Authenticating Users
    • Using Hyphen UI Kit
      • Account Management Screen
    • Sample Project
  • Android SDK
    • Quick Start
    • Authenticating Users
    • Handling 2FA / Transaction Request
    • Using Hyphen UI Kit
    • Sending Transactions
  • Flutter SDK
    • Quick Start
    • Authenticating Users
    • Using Hyphen UI Kit
    • Sending Transactions
    • Example App
  • Hybrid Custody
    • Into the Hybrid Custody
  • Without Using SDK
    • Authenticating Users
    • Handling 2FA Push
  • REST API
    • API Reference
      • Account
      • Auth
      • Device
      • Key
      • Sign
    • Swagger
Powered by GitBook
On this page
  • Create an App in the Dashboard
  • Install the SDK using SPM
  • Configuring the SDK

Was this helpful?

  1. iOS SDK

Quick Start

Start by Using Hyphen iOS SDK

PreviousMechanism PaperNextAuthenticating Users

Last updated 1 year ago

Was this helpful?

Create an App in the Dashboard

You need to create an app in the 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.

Edit Package.swift of your project to add Hyphen SDK.

import PackageDescription

let package = Package(
    name: "my-project",
    dependencies: [
        .package(url: "https://github.com/hyphen-at/hyphen-ios-sdk.git"),
        ...
    ],
    targets: [...]
)
  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".

Configuring the SDK

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

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)
    }
}

Sorry, the example is not provided yet.

Hyphen Dashboard