Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Kieran Tross
8,266 PointsHas anyone used realm before for database management. I'm using realm to save data in my inventory app.
Below is a snippet of how i'm saving the data to my realm file. I need assistance with saving the data. If i create a site called "Corporate" and i save an item to appliance category. When i create a new site called "abc house" the appliance shows up in that site list as well.
Can someone help me or point me in the right direction?
class Location: Object {
dynamic var siteName: String? = nil
dynamic var siteAddress: String? = nil
let buildingMaterials = List<BuildingLocation>()
let appliances = List<ApplianceLocation>()
}
class ApplianceLocation: Object {
dynamic var itemName: String? = nil
dynamic var quantity: Int = 0
var applianceLocation: Location? {
return linkingObjects(Location.self, forProperty: "appliances").first
}
}