Skip to content

Instantly share code, notes, and snippets.

@mauerbac
Last active February 1, 2018 01:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mauerbac/4dd686a390b6cb305a358844568c0eb4 to your computer and use it in GitHub Desktop.
Save mauerbac/4dd686a390b6cb305a358844568c0eb4 to your computer and use it in GitHub Desktop.
Full code snippet for iOS getting started (Swift)
// AppDelegate.swift
// iOS Getting Started Guide (Objective C)
//
import UIKit
import OptimizelySDKiOS
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
let optimizelyManager = OPTLYManager.init {(builder) in
builder!.projectId = "project_id"
}
optimizelyManager?.initializeWithCallback({ (error, client) in
let variation = client?.activate("my_experiment", userId: "currentUser")
client?.track("my_conversion", userId: "currentUser")
})
return true
}
@alda-optimizely
Copy link

@mauerbac
Can you change the following:
// iOS Getting Started Guide (Objective C) --> // iOS Getting Started Guide (Swift)

optimizelyManager?.initializeWithCallback({ (error, client) in --> optimizelyManager?.initialize(callback: {(error, optimizelyClient) in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment