Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function to add notification listeners to the Optimizely client
func addListeners() {
let notificationCenter = optimizely.notificationCenter
//notification fired when a value is returned by isFeatureEnabled function call
_ = notificationCenter?.addDecisionNotificationListener(decisionListener: { (type, userId, attributes, decisionInfo) in
print("Received decision notification: \(type) \(userId) \(String(describing: attributes)) \(decisionInfo)")
})
//notification fired when SDK polls for a new datafile and the datafile has changed
_ = notificationCenter?.addDatafileChangeNotificationListener(datafileListener: { (_) in
print("data file did change!")
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment