Home > Software design >  How to support Xcode Templates for SwiftPM?
How to support Xcode Templates for SwiftPM?

Time:01-01

I have Xcode Template that generate a bunch of files (not project) with some predefined repetitive code (for example classes for MVVM pattern). When I try to create these files in Xcode Project all works fine (I can find and create my templates in New File… menu), but when I try to do the same thing in SwiftPM I can't find my templates in the New File… menu.

All my templates are leaving in ~/Library/Developer/Xcode/Templates/**/*.xctemplate.

What should I do to show templates for SwiftPM as well?

CodePudding user response:

After some research of /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates/ folder I found that some default templates have the property SupportsSwiftPackage that set to YES. I added it to my templates and it finally works.

enter image description here

  • Related