Considerations and description of the content in template-package.
Partly inspired by https://github.com/mattmassicotte/PackageTemplate
- Create and clone repository named
snap-<package-name>
- Create package (Multiplatform > Library) named
Snap<PackageName>
- Move files from
Snap<PackageName>/
to root of repository - Copy files from template-package folder (make sure to include .-files)
- Fix names in
Package.swift
- Move files from
- Create a demo project if suitable
- Setup GitHub page: Add Description and Topics, uncheck Packages and Deployments
- Add to Swift Package Index
- Update Badge and Documentation urls in README.md
TODO: Add Code of Conduct: https://www.contributor-covenant.org
Some adjustments to the Package definition (see Package.swift).
platforms: [
.iOS(.v18), .macOS(.v15)
],
// swift-tools-version: 6.0
...
swiftLanguageModes: [.version("6")]
A default ignore list for packages (see .gitignore).
Configuration for the Swift Package Index to build DocC documentation.
I chose to use the MIT License (created by Github template) because it is most commonly used in the community (see LICENSE).
Create a demo project if suitable and configure project to edit the package directly from the demo project:
- Create a project in package root, name it
PackageNameDemo
- Add local package as dependency to the project:
- Open Project > Package Dependencies > Add package > "Add local"
- Remove unnecessary files: Assets.xcassets, Preview Content (clear DEVELOPMENT_ASSET_PATHS)
- Copy IDETemplateMacros.plist to demo project:
- From: /package-template/.swiftpm/xcode/xcshareddata/IDETemplateMacros.plist
- To: /SnapDemo/SnapDemo.xcodeproj/project.xcworkspace/xcshareddata/IDETemplateMacros.plist
- Replace all file header with the one from the previous step.
- Convert root folder to Group and create folder
Views
in it, moveContentView.swift
into it. - Set Swift Language Version to 6.