Xcode: Possible to auto-create stubs for methods required by Protocol interface?

后端 未结 10 1107
心在旅途
心在旅途 2020-12-13 08:41

Coming from an Eclipse / Java background, one of my favorite features is the ability to quickly stub out all the methods required by an interface. In Eclipse, I can choose

相关标签:
10条回答
  • 2020-12-13 09:22

    Accessorizer will write the encode and decode methods for ivars passed to it (NSCoding protocol and for NSDocument archiving). It will also generate string constants either static or #define with a custom prefix; copyWithZone:; and other things if you need - all from a simple shortcut via Services or from the toolbar. Accessorizer keyed archiving

    0 讨论(0)
  • 2020-12-13 09:22

    I believe that Accessorizer will do what you want.

    0 讨论(0)
  • 2020-12-13 09:23

    Based on AllanCraig's "Create @property, @synthesize & dealloc from Variable Declaration" ruby script, I made one to generate implementation stubs from interface ones: http://pastebin.com/4T2LTBh6

    How to use?

    • Setup the script on your XCode (Shell Script) and assign a shortcut for it (e.g. CMD+5).
    • Select lines from your interface file in which you want to generate the implementation, and press the hotkey.
    • Your .m will contain your selected methods.
    0 讨论(0)
  • 2020-12-13 09:28

    I know this is an old question but if you'd like to always see the latest definitions just right click on the class in question and Jump to Definition. Here lyes all the current non-deprecated functions so you aren't relying on a 3rd party to stay up to date.

    0 讨论(0)
提交回复
热议问题