开发者

Xcode/iPhone Code templates

开发者 https://www.devze.com 2022-12-23 17:35 出处:网络
Is there some tool in Xcode that allows me to store snippets of code I often reuse in vari开发者_开发技巧ous applications so I do not have to retype it each time? I am talking about things like all th

Is there some tool in Xcode that allows me to store snippets of code I often reuse in vari开发者_开发技巧ous applications so I do not have to retype it each time? I am talking about things like all the code that goes into defining Table Delegate Methods and Table Source Methods, UIAlertViews code and such. I just would like to have my own private repository where I can put snippets of code I think I may need in the future in other apps. Is there anything like that? Thanks for any help.


I guess the answer to your need is discussed in this page http://www.turkeysheartrhinos.com/?p=8. Look at the "Custom TextMate – Like Macros" section.


In Interface Builder you can drag and drop components you've built into the library under the Custom Objects list. These can be reused in other XIBs you build later.

I'm not sure about code snippets in Xcode itself, I would find that useful too. If you are talking reuse though, can you put alot of your generic stuff in superclasses that you can inherit from when appropriate?


Try "Edit User Scripts..." under the script menu in Xcode. Look at the scripts under the "HeaderDoc" header to see some examples of inserting templates into code. You'll have to reformat your snippets into blocks of Perl like these, but this approach also gives you those neat tab-through-able input areas like you see when you autocomplete method calls.


How about using the tool "sinppets" ?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号