Hi.
I am really new to this ... so please bare with me ...I think that I am missing a step but I canot find anything that explains the many errors that I am seeing ......
- Create a new iOS project ... iOS Single View application; language:Swift, and Use Core Data,
- With the datamodel file, add an Entity 'Person' with two attibutes, age (int64) and name (string)
- Editor Menu ... Create NSManagedObject Subclass... Next/Next/Create (boxes all ticked on the way through)
- Two files are created both with errors all over the place.
The first file that is generated is 'Person+CoreDataClass.swift' :
import Foundation
import CoreData
@objc(Person)
public class Person: NSManagedObject {
}
There is one error in this file: 'Invalid redeclaration of 'Person' for the Public Class declaration.
The second file is 'Person+CoreDataProperties.swift':
import Foundation
import CoreData
extension Person {
@nonobjc public class func fetchRequest() -> NSFetchRequest<Person> {
return NSFetchRequest<Person>(entityName: "Person");
}
@NSManaged public var age: Int64
@NSManaged public var name: String?
}
There are 6 (six!) errors in this code ...
- extrension generates: 'Person is ambiguous for type lookup in this context'
- The public class function also generates 'Person is ambiguous for type lookup in this context'
- Both @NSManaged lines reports that they are 'only allowed on an instance property or method';
- As well as 'Extensions may not contain stored properties'
Why? ... or rather how can I have done something wrong so soon? ... all this code is generated by Xcode itself ...
Thanks.