Created
May 15, 2018 00:49
-
-
Save harrysummers/971babbd8c30a45b0ad7b924e24cd884 to your computer and use it in GitHub Desktop.
Custom prepareForDeletion
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
public override func prepareForDeletion() { | |
if let artist = artist { | |
let albums = artist.albums | |
if albums == nil || albums?.count == 1 { | |
managedObjectContext?.delete(artist) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment