In Core Data I have made 2 entities -- a) WeatherResponse which has 'location' as an attribute and b) Forecast which has 'Day', 'Temperature' and 'Condition' as the attributes. Below is the 'one to many' relationship.
The classes are below:
class CDWeatherResp: NSManagedObject {
@NSManaged var cdLocation: String?
@NSManaged var locForecast: NSOrderedSet?
}
class CDForecast: NSManagedObject {
@NSManaged var day: String?
@NSManaged var temperature: NSNumber?
@NSManaged var conditions: String?
@NSManaged var forecastLocation: NSManagedObject?
}
I have managed to save some data as NSOrderedSet in: CDWeatherResp.locForecast relationship. (This is working fine. Each index contains 1 forecast related info (i.e.: day, temperature & conditions)
Question: How do I access the attributes of the "CDForecast" class so that I can do something like 'CDWeatherResp.locForecast.day'
I saw this post but could not replicate it for the way I want