Uploaded image for project: 'Swift'
  1. Swift
  2. SR-2673

@NSManaged property can't satisfy protocol requirement

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Medium
    • Resolution: Done
    • Component/s: Compiler
    • Labels:
    • Environment:

      macOS 10.12 GM, Xcode 8 (final)

      Description

      I don't know if this should be a radar issue, or an issue here - please let me know if I should refile this as a radar. Consider the following code:

      @objc public protocol XUObjectProtocol: NSObjectProtocol { }
      
      @objc protocol IdentifiableEntity: XUObjectProtocol {
      	var entityID: String { get set }
      }
      
      class XUObject: NSManagedObject, IdentifiableEntity {
      	@NSManaged var entityID: String
      }
      

      This produces an error that "Stored property 'entityID' requires an initial value or should be @NSManaged". Adding a default value, of course produces an error that "@NSManaged property cannot have an initial value".

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jrose Jordan Rose
              Reporter:
              charlieMonroe Charlie Monroe
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: