Generate code for core data attributes in xcode 4
Asked Answered
T

3

10

In xcode 3 there was a helpful feature in the data model builder where you could highlight some attributes/relationships in an entity, right-click, and choose to copy method and property declarations to the clipboard. (You could choose if you wanted objective-c 2.0 property declarations also). Then you could paste them into your NSManagedObject subclass.

I see how you can still generate the entire class file; but this isn't helpful if you are adding attributes to an existing entity. Have they removed this feature from xcode 4? I used it all the time!

Touristy answered 16/3, 2011 at 15:29 Comment(0)
E
10

See the Core Data Model Editor Help: Creating Objective-C Accessor Methods for a Managed Object

Endways answered 18/3, 2011 at 10:45 Comment(6)
Thanks. That works, but it's kind of annoying. How are you supposed to know that the regular "edit>copy" command would actually do that? In Xcode 3 there was a specific option to do that. Plus, it no longer copies the headers for the CoreDataGeneratedAccessors category.Touristy
It's not perfect, but not that the Special Paste menu item reflects the context (Interfaces, Implementations).Endways
That's true, but it breaks the principle of discovery. At the point you are looking for the feature (and generation of code is a different feature to copying) there is no way to discover it.Maurilla
It is not working on Xcode 4.2. Back to square zero again. BTW, I hate Xcode 4. It is the crappiest app Apple ever created. It is a leap backwards compared to Xcode 3.Pout
Works like a charm in Xcode 4.3.2. Excellent! Only gripe: It's not available via the context-sensitive menu (via Option-Click). That would be a nice touch.Blues
For over a year I was too lazy to look up what happened from Xcode 3-4, and today I finally decided to look. Thank you so much for posting. :)Nievelt
S
5

You may find MoGenerator useful.

Skelp answered 24/3, 2011 at 22:18 Comment(0)
H
2

Watch out for the fact that the special paste menu item only appears in the Edit menu not the contextual menu in the source editor.

Hopefully answered 12/4, 2011 at 16:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.