Skip to content

Figure out whether property initialisers _might_ be possible #14

@helje5

Description

@helje5

@NSManaged doesn't allow this:

@Model class Item: NSManagedObject {
  var date = Date()
}

This complains that the @NSManaged var item must not have initialization expressions.

I don't think a macro can remove the expression, but maybe the property could be shadowed somehow. Which would also potentially help w/ Issue #2 .
I.e. instead of generating:

@NSManaged var date : Date

something more like:

var date = Date() {
  didSet { _date = newValue }
}
@objc(date)
@NSManaged var _date : Date

Potentially possible, not quite sure. That the _date is renamed might pose the biggest issue here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions