@@ -26,8 +26,7 @@ Please note below that _\<platform\>_ is used to represent the platform on which
26
26
#### Cocoapod
27
27
1 . Add the following lines to the _ Podfile_ :<pre >
28
28
``` use_frameworks! ```
29
- ``` pod 'OptimizelySDK', :git => 'https://github.com/optimizely/swift-sdk.git', :branch => 'master' ```
30
- ``` pod 'OptimizelySDK', :path => '~/Development/swift-sdk' ```
29
+ ``` pod 'OptimizelySwiftSDK', '3.1.0-beta ```
31
30
</pre >
32
31
33
32
2 . Run the following command: <pre >``` pod install ``` </pre >
@@ -51,21 +50,27 @@ github "optimizely/swift-sdk" "master"
51
50
- In the script area include:<pre >
52
51
``` /usr/local/bin/carthage copy-frameworks ``` </pre >
53
52
- Add the frameworks to the ** Input Files** list:<pre >
54
- ``` $(SRCROOT)/Carthage/Build/<platform>/OptimizelySDK .framework ```
53
+ ``` $(SRCROOT)/Carthage/Build/<platform>/Optimizely .framework ```
55
54
</pre >
56
55
57
56
Futher installation instructions for Carthage: https://github.com/Carthage/Carthage
58
57
58
+ A sample code for SDK initialization and experiments:
59
+
59
60
```
60
- let optimizely = OptimizelyClient(sdkKey:"somesdkkey")
61
-
62
- if let _ try? = optimizely.start(datafile:json) {
63
- let variation = optimizely.activate(experimentKey: "background_experiment", userId: "userId", attributes: ["doubleKey":5])
64
-
65
- let basicVariation = optimizely.track(eventKey: "sample_conversion", userId: "userId")
66
- }
61
+ let optimizely = OptimizelyClient(sdkKey:"somesdkkey")
62
+
63
+ optimizely.start(datafile:json) { result in
64
+ do {
65
+ let variation = try optimizely.activate(experimentKey: "background_experiment", userId: "userId", attributes: ["doubleKey":5])
66
+ try optimizely.track(eventKey: "sample_conversion", userId: "userId")
67
+ } catch {
68
+ print(error)
69
+ }
70
+ }
67
71
```
68
72
73
+
69
74
### Contributing
70
75
Please see [ CONTRIBUTING] ( CONTRIBUTING.md ) .
71
76
0 commit comments