Skip to content

Build & run Swift on macOS & Linux, all from your mac thanks to Docker, with basic C interop

Notifications You must be signed in to change notification settings

algal/swiftecho

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Swift Echo

What's this?

Basic stuff here, but this little project illustrates a few things that I want to remember for cross-platform Swift development:

  • how to setup a Swift Package Manager project that compiles on macOS and Linux, using build directives to conditionally import Glibc vs Darwin.C

  • how to setup a Makefile so you can test building and running on macOS and Linux OS, from the comfort of your macOS command line thanks to Docker

  • basic interop between Swift and C-oriented system API, using getline to echo standard input

Things to try:

$ make build_osx
$ make run_osx # then type a line and have it echoed back
$ make build_linux # if you have Docker installed...
$ make run_linux
$ swift package generate-xcodeproj # to edit in Xcode

About

Build & run Swift on macOS & Linux, all from your mac thanks to Docker, with basic C interop

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published