Quickstart

Install the Appwin modules your app needs, in a few minutes.

The SDK is built on Appwin Core, the main module: it manages the connection, the session, and the device identity. The other modules (Community, Support, Notifications, Analytics) add their features. They all share the same App ID, so you only configure Core once.

Before you start

  1. 1

    Select the modules to install

    The code in the following steps adapts to your selection.

    Analytics

    Support

    Notifications

    Community

  2. 2

    Install and configure the SDK

    Pick your platform below: the code adapts to your selection.

    In Xcode, open File → Add Package Dependencies, then add https://github.com/appwin-dev/appwin-ios. The generated code lists the Swift products that need to be linked to your target.

    Dependencies

    swift
    .package(url: "https://github.com/appwin-dev/appwin-ios", from: "0.9.1")
    
    .target(name: "MyApp", dependencies: [
        .product(name: "AppwinCore", package: "Appwin"),
        .product(name: "AppwinCommunity", package: "Appwin"),
        .product(name: "AppwinSupport", package: "Appwin"),
    ])
    

    Appwin Core is a required dependency, added automatically with your modules. It handles identity, session and networking.

    Initialisation

    swift
    import AppwinCore
    import AppwinCommunity
    import AppwinSupport
    import SwiftUI
    
    @main
    struct MyApp: App {
        init() {
            AppwinCore.configure(projectAppId: "your-app-id")
        }
    
        var body: some Scene {
            WindowGroup {
                ContentView()
                    .task {
                        let community = await AppwinCommunity.initialize()
                        let support = await AppwinSupport.initialize()
                    }
            }
        }
    }
    
    • Each initialize() answers rather than throwing. Gate your own entry point on the result - the SDK does not own your navigation, so it cannot hide your tab for you.
    • The session opens by itself. Once your own user signs in, call AppwinCore.identify(externalId) once: the id is kept across launches. Use AppwinCore.updateUser(attributes) when a attribute changes and AppwinCore.logout() at sign-out. The products have no login of their own.
  3. 3

    Verify the SDK connection

    After configure has run, print the device identifier. A non-null value confirms that Appwin Core is set up for your project; the session opens by itself with the first call that needs it. The initialize calls in the generated code then report whether each module is available.

    swift
    print(AppwinCore.deviceId ?? "configure was not called")
    

Add the features to your app

The SDK is now installed, but Community and Support still need to be connected to your navigation, while Notifications and Analytics require configuration for their respective use cases. The following pages continue from this point and also explain what you manage from the dashboard.