TMin
TMin

Reputation: 2349

Explicitly declare getter '-newRelationship' with '__attribute__((objc_method_family(none)))' to return an 'unowned' object mogenerator

I'm getting the error

Explicitly declare getter '-newRelationship' with 'attribute((objc_method_family(none)))' to return an 'unowned' object

when attempting to access this property

@property (nonatomic, strong) NSString* newBornTypeRawValue;

In an extension on a subclass. I'm using coreData and mogenerator. The superClass is generated with mogenerator, then in a swift extension on the subclass I have the following code

extension SubClassName {
    var newBornType: DifferentType? { 
        get {
            willAccessValue(forKey: "newBornTypeRawValue")
            let storedStringOP = primitiveNewBornTypeRawValue()
            didAccessValue(forKey: "newBornTypeRawValue")

            if let storedString = storedStringOP {
                return DifferentType(storedString)
            } else {
                return nil
            }
        }

        set {

            guard let newValue = newValue else {
                willAccessValue(forKey: "newBornTypeRawValue")
                setPrimitiveNewBornTypeRawValue(nil) 
                self.didAccessValue(forKey: "newBornTypeRawValue")
                return
            }

            let rawValue = newValue.rawValue //This returns a String

            willAccessValue(forKey: "newBornTypeRawValue")
            setPrimitiveNewBornTypeRawValue(rawValue)
            didAccessValue(forKey: "newBornTypeRawValue")

        }
    }
}

Upvotes: 1

Views: 201

Answers (0)

Related Questions