mercredi 5 août 2015

I have a subclass of a NSManagedObject, when checking if the property value of an instance is nil with a control flow statement I get the following error;

'Int' is not convertible to 'Range

What I am trying to do is check if the property value has a value if so then create an instance of that value, (the value type is another subclass of a NSManagaedObject).

Subclass:

class Items: NSManagedObject {

@NSManaged var index: NSNumber
@NSManaged var title: String
@NSManaged var folder: Folder

}

Error is In my table view when checking the value - I fetch all Items objects and cast to an array to display in the tableview:

Error for control flow

  var folder: Folder!

  //Error occurs here 
  if self.items[indexPath!.row].folder == nil {  
       folder = self.items[indexPath!.row].folder
  }

I am not sure why this is occurring and how to resolve the issue, has anybody got any solutions to what I am trying to do ?

Aucun commentaire:

Enregistrer un commentaire