Created
May 28, 2018 07:12
-
-
Save ktanaka117/8c78ac238d50d5c359bb68f43cdb76a9 to your computer and use it in GitHub Desktop.
こういうのやろうと思ったんだけど、deleteした後のfavoriteListObjectは[invalid object]的なサムシングになるんだね。 #CodePiece
This file contains hidden or 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
do { | |
let realm = try Realm() | |
let favoriteListObjects = realm.objects(FavoriteListObject.self).filter("id like '\(id)'") | |
guard let favoriteListObject = favoriteListObjects.first else { | |
completion(.failure(FavoriteListDataStoreError.deleteError)) | |
return | |
} | |
try realm.write() { | |
realm.delete(favoriteListObject) | |
} | |
completion(.success((favoriteListObject))) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment