Add Swift SPM package
This PR introduces a Package.swift manifest to enable Swift Package Manager (SPM) support for the Box2D library. With this change, Swift developers can now easily integrate Box2D into their projects by declaring it as a dependency in their own Package.swift files.
Changes:
- Added a Package.swift file to the root of the repository.
- Defined targets and sources for Box2D's C/C++ code to allow compilation in Swift projects.
- Exposed the Box2D module under the name
box2d
Usage Example (in Swift project's Package.swift):
.package(url: "https://github.com/erincatto/box2d.git", from: "your-version-tag")
I understand that pull requests might not be your preferred way of contributing - if that’s the case, please let me know and I’ll be happy to open an issue and attach the file there instead.
I think this is nice but I have no way to validate or maintain this. I'm not a Swift programmer. My usual requirement for this sort of thing is that there is a GitHub action that tests it.
I've added a GitHub Action to test the Swift Package Manager integration. The swift-package-manager job validates that the package builds correctly in both debug and release configurations and that the package manifest is valid. If you approve the workflow you will see it running.