-
-
Save anonymous/4619dbfc30c346a63c05 to your computer and use it in GitHub Desktop.
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
private let realm = try! Realm() | |
func save(customObject: CustomObject) -> Observable<Bool> { | |
return create({ (observer) -> Disposable in | |
do { | |
try self.realm.write { | |
self.realm.add(customObject, update: true) | |
observer.onNext(true) | |
} | |
} catch { | |
observer.onError(NSError(domai...) | |
} | |
observer.onCompleted() //I'm not sure why you put this in "Some other condition", isnt supposed to be called after .onNext or .onError ? | |
return AnonymousDisposable { | |
} | |
}) | |
} |
sergdort
commented
Dec 29, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment