Skip to content

Commit b8fb668

Browse files
(chore): add new feature list as well as update demo app to show these features (#209)
* add new feature list as well as update demo app to show these features * take out custom to see if coveralls goes up * slight refactor for swift test app
1 parent 6ae7920 commit b8fb668

File tree

2 files changed

+30
-21
lines changed

2 files changed

+30
-21
lines changed

CHANGELOG.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
# Optimizely Swift SDK Changelog
22

3-
## 3.1.0-RC
4-
Date
3+
## 3.1.0-beta
4+
May 28, 2019
55

66
This the initial release of the Swift SDK. It is a pure Swift implementation take complete advantage of language features and performance. It supports objective-C as well through objective-c only API. It uses Swift 4.2 but we will be upgrading to 5.0 soon.
77

88
This modernized version of the SDK is meant to replace the Objective-C SDK.
99

1010
### New Features
11-
* No new features for this release. It supports all of the 3.1 features in all of Optimizély's SDKs.
11+
* By default the datafile handler does updates every 10 minutes when the application is in the foreground. To disable this, set the periodicUpdateInterval to zero. If you do allow for polling, the project will update automatically when a new datafile change is received.
12+
* On top of the above functionality, the developer may register for a datafile change notification. This notification will be called anytime a new datafile is downloaded to cache and is used to reinitialize the optimizely client automatically.
13+
* The event handler batches events and will run every 5 minutes in the foreground to send events.
1214

1315
### Bug Fixes:
14-
* Change all instances of attributes and eventTags from NSDictionary<NSString*,NSObject*> to NSDictionary<NSString*,id>
1516

1617
### Breaking Changes
1718

DemoSwiftApp/AppDelegate.swift

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,16 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
5050
// - initialize immediately with the given JSON datafile or its cached copy
5151
// - no network delay, but the local copy is not guaranteed to be in sync with the server experiment settings
5252

53-
initializeOptimizelySDKAsynchronous()
53+
initializeOptimizelySDKWithCustomization()
5454
}
5555

5656
// MARK: - Initialization Examples
5757

5858
func initializeOptimizelySDKAsynchronous() {
5959
optimizely = OptimizelyClient(sdkKey: sdkKey, defaultLogLevel: logLevel)
60-
60+
61+
addListeners()
62+
6163
optimizely.start { result in
6264
switch result {
6365
case .failure(let error):
@@ -76,10 +78,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
7678
}
7779

7880
optimizely = OptimizelyClient(sdkKey: sdkKey, defaultLogLevel: logLevel)
81+
82+
addListeners()
7983

8084
do {
8185
let datafileJSON = try String(contentsOfFile: localDatafilePath, encoding: .utf8)
8286
try optimizely!.start(datafile: datafileJSON)
87+
8388
print("Optimizely SDK initialized successfully!")
8489
} catch {
8590
print("Optimizely SDK initiliazation failed: \(error)")
@@ -101,14 +106,30 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
101106
periodicDownloadInterval: customDownloadIntervalInSecs,
102107
defaultLogLevel: logLevel)
103108

109+
110+
addListeners()
111+
112+
// initialize SDK
113+
optimizely!.start { result in
114+
switch result {
115+
case .failure(let error):
116+
print("Optimizely SDK initiliazation failed: \(error)")
117+
case .success:
118+
print("Optimizely SDK initialized successfully!")
119+
}
120+
self.startWithRootViewController()
121+
}
122+
}
123+
124+
func addListeners() {
104125
// notification listeners
105126

106127
_ = optimizely.notificationCenter.addDecisionNotificationListener(decisionListener: { (type, userId, attributes, decisionInfo) in
107128
print("Received decision notification: \(type) \(userId) \(String(describing: attributes)) \(decisionInfo)")
108-
})
129+
})
109130

110131
_ = optimizely.notificationCenter.addTrackNotificationListener(trackListener: { (eventKey, userId, attributes, eventTags, event) in
111-
print("Received track notification: \(eventKey) \(userId) \(String(describing: attributes)) \(String(describing: eventTags)) \(event)")
132+
print("Received track notification: \(eventKey) \(userId) \(String(describing: attributes)) \(String(describing: eventTags)) \(event)")
112133
})
113134

114135
_ = optimizely.notificationCenter.addDatafileChangeNotificationListener(datafileListener: { (data) in
@@ -130,19 +151,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
130151
}
131152
}
132153
})
133-
134-
// initialize SDK
135-
136-
optimizely!.start { result in
137-
switch result {
138-
case .failure(let error):
139-
print("Optimizely SDK initiliazation failed: \(error)")
140-
case .success:
141-
print("Optimizely SDK initialized successfully!")
142-
}
143-
144-
self.startWithRootViewController()
145-
}
146154
}
147155

148156
// MARK: - ViewControl

0 commit comments

Comments
 (0)