A word of advice from someone who struggled with this for about a week and finally got it figured out.
If you start an app project in Swift playground on the iPad and then get to a point where you need to port it over to Xcode for more tools and options there can be an issue with the app Identifier and certain capabilities such and CloudKit. Specifically, everything will appear to match correctly, but the app will not be able to access the database on iCloud, because it is not authorized.
The only solution that worked for me was to create a new project in Xcode, with a new name and app identifier and then copy the files over manually. Once that is complete everything should work again.
Attach up to 5 files which will be available for other members to download.