Skip to content

Repository files navigation

Swift6-module-template

Test

Important

Use swift TEMPLATE/configure.swift to interactively your own project name and other details to this template.

Alternatively, use the RECIPE for a walkthrough of starting with "Open Xcode" and ending with the exact contents of this repo.

Replace this top heading with your own project name and status badge, and replace the rest of this section with what the project does, and show it (e.g. with screenshots).

This is an opinionated template for every Swift module, that provides:

  • An explicit license (MIT, at LICENSE)
  • A .gitignore with modern defaults
  • Continuous integration to perform testing
  • An example app that is wired to the Swift module

Swift 6 directory layout

What this project does

xxPROJECTxNAMExx is a reusable Swift 6 module. It provides:

  • A Swift Package Manager library and tests
  • An example SwiftUI app in an Xcode project
  • Semantic versioning, a CHANGELOG, and an MIT license
  • GitHub Actions testing with the workflows published for Swift packages
  • EditorConfig, a .gitignore, and enforced formatting

The example app shows a white king (♔).

Example

Clone the repo and open Example/Example.xcodeproj. Run the Example scheme on a recent iPhone simulator.

Installation

Add this package with Swift Package Manager. In Xcode that is File > Add Package Dependencies...

Development

Format the files the lint workflow checks. These commands use npx at @latest so the local write matches .github/workflows/lint.yml. A pinned package would let the local write and the CI check disagree.

npx prettier@latest --write .
npx markdownlint-cli@latest --fix "**/*.md" --ignore node_modules

Testing

Run the test suite with:

xcrun swift test

Maintenance and dependency updates

Do this every quarter or so and please send a PR here if you see updates available:

  1. Identify external Actions in .github/workflows scripts and look for available new versions. Review and then update to the new version if it is safe. GitHub-supported Actions (i.e. under the actions/ organization) may require only cursory review.
  2. Review the Swift versions excluded in .github/workflows/swiftlang-workflows.yml.
  3. Review the RECIPE and confirm that the current latest pubished version of Xcode equals the version asserted at the top of this file. If not, redo the recipe.

References

Important

We use an MIT license for this template. You should carefully consider which license to apply to your own project.

If your project materially relied on external sources to make some decisions, cite them here.

We cite a text formatting policy below. This applies to our README above as well as our workflow rules and other configuration files. If you have a different policy, then please implement it throughout.

  1. We use title case for titles and proper nouns; not for headings and things. This includes our README above as well as our workflow rules and other configuration files. If you have a different policy, then please implement it throughout.
  2. We use an MIT license for this template. You should carefully consider which license to apply to your own project.
  3. Swift ignore rules are inlined from Swift.gitignore. The macOS and secret rules above them come from project-template.
  4. This project is built based on best practices documented in Swift 6 Module Template.
  5. This project is built based on best practices documented in project-template, release 1.0.0.

About

An opinionated starting point for awesome, reusable Swift 6 modules

Topics

Resources

Contributing

Stars

489 stars

Watchers

11 watching

Forks

Releases

Packages

Used by

Contributors

Languages