function to add notification listeners to the Optimizely client
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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