Skip to content

Instantly share code, notes, and snippets.

@ktanaka117
Created May 28, 2018 07:12
Show Gist options
  • Save ktanaka117/8c78ac238d50d5c359bb68f43cdb76a9 to your computer and use it in GitHub Desktop.
Save ktanaka117/8c78ac238d50d5c359bb68f43cdb76a9 to your computer and use it in GitHub Desktop.
こういうのやろうと思ったんだけど、deleteした後のfavoriteListObjectは[invalid object]的なサムシングになるんだね。 #CodePiece
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