magicalpanda / MagicalRecord

Super Awesome Easy Fetching for Core Data!
Other
10.8k stars 1.79k forks source link

shouldImport() false is still creating entities #1190

Open 14lox opened 8 years ago

14lox commented 8 years ago

I have my shouldImport setup like this

override func shouldImport(data: AnyObject?) -> Bool {

        guard let account = data as? [NSObject: AnyObject] else {
            return false
        }
        guard let active = account["active"] as? Bool else {
            return false
        }
        return active
    }

so it only adds active accounts If I run MR_importFromArray

MagicalRecord.saveWithBlock({ (context) -> Void in

             user.accounts = Set(Account.MR_importFromArray(accounts, inContext: context))

            })

The inactive Account's are still being created inside MR_importFromArray but with nil attributes.