Quickstart

Get the StreamLayer Element on screen in under 5 minutes with iOS

iOS Quickstart

This quickstart gets you from zero to seeing the StreamLayer Element on screen in under 5 minutes. For detailed configuration options, see the Integration Guide.

System Requirements

  • Xcode 16+
  • Swift 6+
  • iOS 16+

Installation

Add StreamLayer to your project using SPM:

// In Xcode: File > Add Packages
// Enter: [email protected]:StreamLayer/sdk-ios.git
// Select version and add to your target

Initialize StreamLayer

Import and initialize in your AppDelegate or root view:

import StreamLayer

@main
class AppDelegate: UIResponder, UIApplicationDelegate {
    func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
    ) -> Bool {
        StreamLayer.initialize(apiKey: "YOUR_SDK_API_KEY")
        return true
    }
}

Add the StreamLayer Element

In your main UIViewController:

import StreamLayer

class ViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()

        let overlayVC = SLROverlayViewController()
        addChild(overlayVC)
        view.addSubview(overlayVC.view)
        overlayVC.view.frame = view.bounds
        overlayVC.didMove(toParent: self)
    }
}

Run Your App

# Build and run in Xcode or from command line
xcodebuild -scheme YourApp -destination 'platform=iOS Simulator,name=iPhone 15'

You should now see the StreamLayer Element on your screen.

Related