1 Reply
      Latest reply: Dec 28, 2016 4:12 PM by eskimo RSS
      Folbo Level 1 Level 1 (0 points)

        Hi.

        I think that I am missing a step ...

         

        1. Create a new iOS project ... iOS Single View application; language:Swift, and Use Core Data,
        2. With the datamodel file, add an Entity 'MyTestEntity' with two attibutes, age (int64) and name (string)
        3. Editor Menu ... Create NSManagedObject Subclass... Next/Next/Create (boxes all ticked on the way through)
        4. Two files are created both with errors al over the place

         

        https://www.dropbox.com/s/dtqr00zer2kvb5p/Screen%20Shot%202016-12-16%20at%2011.44.00.png?dl=0

        https://www.dropbox.com/s/uiqzl4tb7pt92u6/Screen%20Shot%202016-12-16%20at%2011.44.12.png?dl=0

        https://www.dropbox.com/s/ufudlayeik2niq3/Screen%20Shot%202016-12-16%20at%2011.44.31.png?dl=0

         

        I can only assume that I have missed a step ... because I would not expect Xcode generated code to have errors ... unless it is looking for something that I have forgotten to do!

         

        Thanks.

        • Re: Newbie Question: Errors in Xcode generated code ... why?
          eskimo Apple Staff Apple Staff (7,530 points)

          The simple answer here is that you don’t need step 2.  By default a new entity is set up so that Xcode manages all of its source code internally; you don’t need to create the .swift files via Editor > Create NSManagedObject Subclass.

          You can change this policy via the Codegen popup in the data model inspector but if you’re just getting started it’s easier to stick with the default.

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"