Skip to content

Commit 0d79428

Browse files
jaeoptthomaszurkan-optimizely
authored andcommitted
(chore): fix README errors (#201)
* fix README errors * fix per review
1 parent 4cc9139 commit 0d79428

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

README.md

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ Please note below that _\<platform\>_ is used to represent the platform on which
2626
#### Cocoapod
2727
1. Add the following lines to the _Podfile_:<pre>
2828
```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```
3130
</pre>
3231

3332
2. Run the following command: <pre>``` pod install ```</pre>
@@ -51,21 +50,27 @@ github "optimizely/swift-sdk" "master"
5150
- In the script area include:<pre>
5251
```/usr/local/bin/carthage copy-frameworks```</pre>
5352
- Add the frameworks to the **Input Files** list:<pre>
54-
```$(SRCROOT)/Carthage/Build/<platform>/OptimizelySDK.framework```
53+
```$(SRCROOT)/Carthage/Build/<platform>/Optimizely.framework```
5554
</pre>
5655

5756
Futher installation instructions for Carthage: https://github.com/Carthage/Carthage
5857

58+
A sample code for SDK initialization and experiments:
59+
5960
```
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+
}
6771
```
6872

73+
6974
### Contributing
7075
Please see [CONTRIBUTING](CONTRIBUTING.md).
7176

0 commit comments

Comments
 (0)