I recently wrestled with the clusterfuck that is iOS code signing, so here's my setup to set up a swift xcodegen project signed with a personal (free) provisioning team. this doesn't require an apple developer account, just a regular apple id.
you'll be able to build whole thing from the command line without ever have to touch xcode ever again.
this was tested with xcode 10.0 (10A255) on High Sierra