In-App Libraries for Swift Playgrounds on iPad

Since the addition of App projects in Swift Playgrounds 4 it’s been easy to use libraries in Swift packages hosted online in your Apps, but it hasn’t been easy or clear how to create libraries for reuse using Swift Playgrounds. My Mac recently fell victim to a power surge, so my iPad is currently my only Swift development option and I found myself wanting to reuse code on multiple projects without having to update said code multiple times when I made improvements. I set about finding a way to do that.

I found the simplest way to accomplish the feat and thought that others would also like to know how. I’ve posted a repository on GitHub that is an example and its file expounds on the process.

I realize this audience is likely more advanced than the demographic for Swift Playgrounds, but if it helps anyone I’m happy to have posted it.

In-App Libraries for Swift Playgrounds