简体   繁体   中英

How to distribute iOS Demo app for Swift library via Swift Package Manager?

My Swift library FlexColorPicker just adopted Swift Package Manager support. The library itself can be added to any project via XCode by doing File → Swift Packages → Add Package Dependency... → choose target → enter https://github.com/RastislavMirek/FlexColorPicker → confirm. However, there is a demo that comes with the library that cannot be run when installed this way.

I want to add another (probably executable) product FlexColorPickerDemo to Package.swift that users can chose to include (or exclude) and then run inside their project just to see what they can do with the library. Besides adding new product and target to the Package.swift file I probably need to add main.swift , right? How should it look so that it allows running the demo as iOS app when installed via SPM?

Any help appreciated, even tutorial link, I don't really know what to Google...

You want a complete demo project to be 'included' in a Package.swift file?

That's not possible, the same reason why bundled resources aren't useable (yet) by SwiftPM: How to include assets / resources in a Swift Package Manager library?

Best way imho would be to update your README file and explain how users can test the library, just like you're already doing.

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