Watch how I create and publish a library with Swift Package Manager for the first time!
With the help of the command line tool is pretty easy. After creating a folder for your project you just need to run
swift package init and SPM takes care of creating the appropriate directory structure for you. After that you can tweak the name, files, dependencies, etc… but the boilerplate will be already there.
You can read more in the SPM Documentation.