Tuesday, 15 May 2012

swift - Filling an array with core data attributes -


I am trying to fill my array.

  var weight = []  

with attributes from an NSManaged object. My main data connection is like a client & lt; - >> Assessment I have a 'weight' attribute within the assessment and I would like to fill my head with these arrays which are the string. My variables:

  var Customer: Customer! = Zero  

Successfully retrieves the specific client I have selected, but I do not know how to fill my array with the values ​​named 'Weight' as the assessment property of that particular customer. I have just found that ...

  client.assessment.count  

which successfully shows me the number of client assessments, but

My managed object classes for clients and assessments are as follows:

Client.swift

  Import Imported Foundation CoreData @OzJEC (Client) Class Client: NSM Object {@NSManaged var Rating: NSS}}  

Assessment. Swift

  import foundation imported codedata @ Is settled (Assessment) Class Assessment: Ansmanej object {@NSManaged var weight: string @ NMS manager var Client: Client}  

Does anyone How do I know?

Update: Screenshot of error found with @Wen's answer. Enter image details here

You can use KVC to gain weight in the set:

  Different weight: NSSE! = Client.assessment.valueForKey ("weight")  

And after that you can sort the item or request all the objects.


No comments:

Post a Comment