{ // You can use SyncUser.current to check logged in user guard user == nil else { completion?() return } let credentials = SyncCredentials.usernamePassword(username: username, password: password) SyncUser.logIn(with: credentials, server: authServerURL) { (user, error) in if let user = user { self.user = user DispatchQueue.main.async { completion?() } } else if let error = error { // handling the error properly } } } Tracking Santa With Realm https://realm.io/news/track-santa-with-realm-swift-database-platform-part-3/
change is the type of enum. token = stepCounter.addNotificationBlock { change in switch change { case .change(let properties): // PropertyChange is the type of struct for property in properties { if property.name == "steps" && property.newValue as! Int > 1000 { print("Congratulations, you've exceeded 1000 steps.") token = nil } } case .error(let error): print("An error occurred: \(error)") case .deleted: print("The object was deleted.") } }