简体   繁体   中英

xcode how to import multiple code snippets into IDE

I have multiple code snippets i found here and i want to import all of them at once into xcode but it does not work. When i try to import even just one code snippet from drag and drop from chrome to xcode it imports the url for the snippet instead of the content.

the end goal is to have my entire team share these snippets. 在此处输入图片说明

I found one way to do this. It seems the code snippet files are plist files generated by xCode IDE. So from the github hosting the .m files here we can drag and drop into the xcode editor. Highlight the text and drag it into the xcode snippet editor. Xcode will then generate the plist file associated with each snippet you dragged in. How to get to these snippets so we can create a repo that your team can share ? this is how:

  1. From your terminal shell traverse to ~/Library/Developer/Xcode/UserData

1b. create a git repo of the folder CodeSnippets and call it CodeSnippets

  1. If there is already an existing folder called CodeSnippets then rename it to CodeSnippets_old

    3.clone the repo you made in 1b.

    note: might have to restart xcode to see the snippets appear.

There is a very cool app that I believe to be the answer to your problem:

http://cocoaholic.com/snippet_edit/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM