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...
Navigate to the app's directory, select Your_app. xcodeproj and hit Add. Navigate to the package's directory, and select the package directory only. Before hitting Add button, make sure "Create folder references for any added folders" is selected.
To distribute code in binary form as a Swift package, create an XCFramework bundle, or artifact, that contains the binaries. Then, make the bundle available locally or on a server: When you host the binaries on a server, create a ZIP archive with the XCFramework in its root directory and make it available publicly.
Put Your Local Swift Package Under Version ControlOpen your Swift package, select the Source Control menu, choose New Git Repositories, check the checkbox next to your package, and click Create. This initializes a Git repository, adds your package to the staging area, and commits your files.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With