XCFramework Support




Starting with version 7.2.0 HYPR SDK for iOS is distributed with .xcframework.

While there are many similarities between the .framework and .xcframework file extensions, the main difference is that .xcframework is compatible with Swift Package Manager, providing a convenient way for Xcode to add update dependencies. More information about Swift packages can be found here.

This page describes backward compatibility with the old style .framework files, using xcframework files to create a Swift package, and consuming XCFrameworks via the created Swift package.

Backwards Compatibility

Updating the HYPR frameworks is a matter of dragging in the new framework files to replace the outdated framework files. HYPR delivers both .framework and .xcframework versions for each of our products.

You can can continue to drag and drop the .framework products in the same manner as previous upgrades. However, if you decide to consume the new .xcframework products with a drag-and-drop replacement, it will also require deleting the reference to the .framework files and adding a reference to the .xcframework files via Xcode.

The following screenshot shows the Frameworks folder containing the new .xcframework products on the right and linking the .xcframeworks via Xcode on the left.


Although this method does work, creating a Swift package and consuming the XCFrameworks with the created package is a much simpler process (see below).

Creating a Swift Package

Swift packages are common with open-source code, and many iOS developers likely have experience creating or consuming Swift packages from source code via public repositories such as GitHub. In the use case for HYPR frameworks, the source code is not exposed, but instead, the Swift package is generated from the compiled binary XCFrameworks.

This is critical for HYPR because the SDK is closed-source, and the Swift package permits linking the compiled binaries. You can find more on the Apple website about Distributing Binary Frameworks as Swift Packages.

  1. Use Xcode to create a new package. Set the name for your package and click Create.
598 550
The resulting Swift package creates the `Package.swift` file and its associated folders.
For consuming the HYPR frameworks, a new `Artifacts` folder is created that houses the XCFrameworks. 
  1. Create the folder; add the .xcframework files; and update the Package.swift file to reference these new frameworks.

Here's a full example of the Package.swift source code:

// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "HYPRSwiftPackage",
    platforms: [
    products: [
            name: "caADP",
            targets: ["caADP"]),
            name: "HYPRADP",
            targets: ["HYPRADP"]),
            name: "HyprCore",
            targets: ["HyprCore"]),
            name: "HYPRCrypto",
            targets: ["HYPRCrypto"]),
            name: "HYPRFaceID",
            targets: ["HYPRFaceID"]),
            name: "HYPRFingerprint",
            targets: ["HYPRFingerprint"]),
            name: "HYPRFirebaseNotificationAdapter",
            targets: ["HYPRFirebaseNotificationAdapter"]),
            name: "HYPRPIN",
            targets: ["HYPRPIN"]),
            name: "HYPRPINHeadless",
            targets: ["HYPRPINHeadless"]),
            name: "HYPRPresence",
            targets: ["HYPRPresence"]),
            name: "HYPRSilent",
            targets: ["HYPRSilent"]),
            name: "TrustKit",
            targets: ["TrustKit"]),
            name: "HYPRFace",
            targets: ["HYPRFace"]),
    dependencies: [
        // Dependencies declare other packages that this package depends on.
        // .package(url: /* package url */, from: "1.0.0"),
    targets: [
        .binaryTarget(name: "caADP", path:"Artifacts/caADP.xcframework"),
        .binaryTarget(name: "HYPRADP", path:"Artifacts/HYPRADP.xcframework"),
        .binaryTarget(name: "HyprCore", path:"Artifacts/HyprCore.xcframework"),
        .binaryTarget(name: "HYPRCrypto", path:"Artifacts/HYPRCrypto.xcframework"),
        .binaryTarget(name: "HYPRFaceID", path:"Artifacts/HYPRFaceID.xcframework"),
        .binaryTarget(name: "HYPRFingerprint", path:"Artifacts/HYPRFingerprint.xcframework"),
        .binaryTarget(name: "HYPRFirebaseNotificationAdapter", path:"Artifacts/HYPRFirebaseNotificationAdapter.xcframework"),
        .binaryTarget(name: "HYPRPIN", path:"Artifacts/HYPRPIN.xcframework"),
        .binaryTarget(name: "HYPRPINHeadless", path:"Artifacts/HYPRPINHeadless.xcframework"),
        .binaryTarget(name: "HYPRPresence", path:"Artifacts/HYPRPresence.xcframework"),
        .binaryTarget(name: "HYPRSilent", path:"Artifacts/HYPRSilent.xcframework"),
        .binaryTarget(name: "TrustKit", path:"Artifacts/TrustKit.xcframework"),
        .binaryTarget(name: "HYPRFace", path:"Artifacts/HYPRFace.xcframework"),

The Swift package is now created and can be consumed through Xcode. While itโ€™s possible to consume local Swift packages, the most common practice is to push the Swift package to a repository housed on a private Git location. For more information, see Apple's article on Organizing Your Code with Local Packages.

Consuming Swift Packages

After you've completed the setup for the Swift package, consuming the package is simple. If the app already consumes the HYPR SDK for iOS, delete the .framework files in the project directory and remove the references to the frameworks in the Xcode project editor.

  1. Select the project > the Package Dependencies tab; then the plus (+) button to add the frameworks.
  1. Paste the URL from the repository of the Swift package that was pushed to Git in the previous section.
  1. Click Add Package. Select the relevant Libraries to add to the project; the HYPR frameworks are automatically fetched and linked through Xcode.

The HYPR SDK for iOS is now fully ready for use.

Updating Swift Packages

Updating the dependency by double-clicking the package and selecting a different version, branch, or commit in the Swift Package Repository.