Creating Sharable Swift Code

Right now, whenever I create code where the platform is irrelevant, I usually just create a command line project for macOS and use that. I have a file with a custom data type that I made in Swift and I want to be able to share this on Github. I now how to use git and all that fancy stuff, but am not sure how to set up my project in Xcode. I want this to work on any platform as it has no other dependencies other than the Swift standard library. I also would like to be able to provide an option for people to download my project as a Swift package. I was reading a bit of stuff regarding this, mainly stuff to the affect of Create a Universal Framework in Swift, but I don't know if that is what I'm looking for (like is this supposed to be a library, a framework, a static framework, something else and how do I use these?). How do I accomplish this sort of thing?

It sounds like the portion of your code that you want to share can be a Swift Package. You will then be able to use it on all platforms, and also (as of Xcode 11) include it into your Xcode projects.

This year's WWDC had a session Creating Swift Packages which covers exactly that.

SwiftPM also has an example Swift package available on Github from which you could get some inspiration.