let nameAttr = NSAttributeDescription() nameAttr.name = "name" nameAttr.attributeType = .stringAttributeType nameAttr.defaultValue = "No Name" let specialityAttr = NSAttributeDescription() specialityAttr.name = "speciality" specialityAttr.attributeType = .stringAttributeType // Boss Description let bossDescription = NSEntityDescription() bossDescription.name = "Boss" // Employee Description let employeeDescription = NSEntityDescription() employeeDescription.name = "Employee" // Relationships let bossOneRel = NSRelationshipDescription() bossOneRel.name = "boss" bossOneRel.minCount = 0 bossOneRel.maxCount = 1 // To-One bossOneRel.destinationEntity = bossDescription let underBossesRel = NSRelationshipDescription() underBossesRel.name = "underBosses" underBossesRel.minCount = 0 underBossesRel.maxCount = 0 // To-Many underBossesRel.deleteRule = .nullifyDeleteRule underBossesRel.destinationEntity = bossDescription bossOneRel.inverseRelationship = underBossesRel underBossesRel.inverseRelationship = bossOneRel let bossesMulRel = NSRelationshipDescription() bossesMulRel.name = "bosses" bossesMulRel.minCount = 0 bossesMulRel.maxCount = 0 bossesMulRel.deleteRule = .nullifyDeleteRule bossesMulRel.destinationEntity = bossDescription let employeeMulRel = NSRelationshipDescription() employeeMulRel.name = "employees" employeeMulRel.minCount = 0 employeeMulRel.maxCount = 0 employeeMulRel.deleteRule = .nullifyDeleteRule employeeMulRel.destinationEntity = employeeDescription bossesMulRel.inverseRelationship = employeeMulRel employeeMulRel.inverseRelationship = bossesMulRel // Assign Relationships bossDescription.properties = [employeeMulRel, underBossesRel, bossOneRel, nameAttr]; employeeDescription.properties = [bossesMulRel, nameAttr, specialityAttr]; Alternatives to this boilerplate ? Keep track of evolution ?