https://github.com/tachoknight/pure-swift-module-example
An example project of a module (library) written in Swift for both macOS and Linux
https://github.com/tachoknight/pure-swift-module-example
framework libraries library module modules staticlibrary swift swift-library swift-package swift-packages
Last synced: about 2 months ago
JSON representation
An example project of a module (library) written in Swift for both macOS and Linux
- Host: GitHub
- URL: https://github.com/tachoknight/pure-swift-module-example
- Owner: tachoknight
- Created: 2022-08-30T19:00:17.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-08-30T20:14:38.000Z (almost 4 years ago)
- Last Synced: 2025-12-01T22:39:05.492Z (7 months ago)
- Topics: framework, libraries, library, module, modules, staticlibrary, swift, swift-library, swift-package, swift-packages
- Language: Shell
- Homepage:
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Pure Swift Module Example
This is a project based on [this blog post](https://railsware.com/blog/creation-of-pure-swift-module/) that demonstrates how to create a module using only Swift.
I found the example a bit out of date (even though it's from 8/11/21) and was having some difficulty getting it to work. With some experimentation and web searching, I was able to come up with a example that works for both macOS and Linux (tested on Swift-5.7-DEV on Fedora 36).
## Files
### `build-n-test.sh`
Run this to build the module/library as well as build and run its accompanying test program (`test.swift`).
This is the file to really look at. It has all the magic incantations that are needed to properly build and run circa Swift 5.6 and 5.7-DEV (on Linux).
### `ZLogger.swift`
A Swift file that contains both a class and a function that are available to other programs
### `test.swift`
Test program that imports the ZLogger framework.