Getting Started with the iOS SDK
Initializing the AppFlags SDK
We suggest initializing the AppFlags SDK in the init
of your App
class or wherever your application initializes so that the SDK initializes as early as possible.
Client initialization
Initialize AppFlagsClient
as shown below:
init() {
let user = AppFlagsUser(key: "user-xyz")
let appFlagsClient = try? AppFlagsClient(
sdkKey: "YOUR_SDK_KEY",
user: user
)
}
tip
You should only create one instance of AppFlagsClient
. We suggest keeping your AppFlagsClient
in a singleton class. See our examples.
User identification
The iOS SDK requires an AppFlagsUser
object to identify the user. This contains a userKey
which is a unique string that identifies the user and does not change between sessions.
You can update the SDK with a new user if the user changes during the application lifecycle.