Apple This Needs To Be Easier: Convert Swift Playgrounds Project to Xcode

preview_player
Показать описание
So you've published an app built with Swift Playgrounds and now you've realized that you can't add things like in-app purchases or Game Center to your app because Apple limits these capabilities inside of Swift Playgrounds. What can you do? How do you convert this Swift Playgrounds project file to an Xcode project file that will allow you do the things you want?

Well... unfortunately there's no 1-button solution. You can't just convert to an Xcode project. Instead you have to create a new Xcode project copy/paste your files from the Swift Playgrounds file over to the new project. Hook things up that might break during this process and most importantly of all make sure your bundle identifier is the same exact one that you've used on the previously uploaded app - otherwise when you upload your new version to AppStore Connect you'll have a new app to release instead of a new version of an existing app.

#swiftplaygrounds #Xcode #spritekit

Hopefully this was helpful if it was consider giving the video a like so others can find it. And thanks for watching!

//Thinks I've Made
Рекомендации по теме
Комментарии
Автор

Thank you for this video, which was exactly what I was looking for. I just did this for a To Do List tutorial app that I started on the iPad and then realized I wanted to do more with. Because I want to continue to use SwiftUI, this wasn't too bad. I created a new iOS app project in Xcode and kept that open on one monitor while opening the Playground I had Air Dropped from the iPad in Xcode on my other monitor. I was able to drag and drop Groups (Views, Models, ViewModels) from the Playground into the project and that worked as expected. The only part where I actually had to copy and paste code was into the App struct. I agree this could still be easier though.

ChileMamaLC
Автор

Good video. I had to do this a couple of weeks ago. After attending WWDC22 and Apple confirmed they didn’t have a way to import a Swift Playground 4 app project into an Xcode project, I had to do the manual process you showed. I created a new Xcode project and moved my .swiftpm content files into the new Xcode project. I then added source control Xcode GitHub integration, included the correct app bundle indentifier, and updated the build number. I then made a couple of easy mods to my app and submitted to the App Store and got the new version/build number approved and released. Thanks for your video confirming what you and I had to do. Next, I’m adding Core Data and CloudKit functionality which I couldn’t do in Swift Playgrounds 4. 🙂👍🏻

andrewhall
Автор

Ah, this is actually really good to know!

I was going to start the build of my new app on Playgrounds to get the ball rolling then transition, however, I think I will skip Playgrounds and go straight to Xcode to avoid any headaches down the line.

ChrisLaupama
Автор

I had no real opinions on all things Swift/SwiftUI/Playgrounds since long time ago, mostly because of ignorance on the whole macOS/iOS dev ecosystem (have been pampered by Unity for so long)… and was wanting to give it a try at some basic testing grounds but thinking they were 100% disposable.
This gives it a different outlook, thanks a lot.

Recently decided to doodle with macOS development: an Apple Motion plugin using Metal which soon prompted me to create a vanilla SwiftUI app project (testing for Motion is too slow iterations wise, better to try the shaders and logic standalone)

To my surprise (all things SwiftUI learning at least) is probably even better on the iPad, I have started to use it for doing some sort of mockups and learning paths, everything is a lot more accessible with premade menus at the top, the system images that can be used, so on and so forth. The templates, the ‘books’ (just more playgrounds for learning), the community…

I gotta say, it’s been a delight embarking on this.
Yes, there’s usual dark hours when nothing works (like the rules for ‘how’ to use them eludes me often)… but with the whole community like Paul Hudson, random blogs, now recently discovered your channel and all of the playgrounds tutorials out there, it’s more than exciting and motivating. More importantly, achievable.

alejmc
Автор

Apple needs tô unify playgrounds and Xcode files or just release Xcode on iPad too.

Rolvr
Автор

Is there way to do this the other way around instead of converting an Xcode to a playground file?

creelfo
Автор

Can you go the other way? Can I change an Xcode file to open in Swift Playgrounds?

katielong
Автор

please upload the videos in Turkish translation

isakarasac
Автор

I have an interesting problem that I hope someone can help me with.

I own a 2012 Mac Mini, and the newest version of MacOS that it supports is Catalina. Because of that, it's limited to Xcode 12.4, and it doesn't support iOS 15.5. Apple requires apps to be signed with iOS 15.5, so I can't use my Mac Mini to submit apps to the App Store. I can't even test apps on my iPad Pro or second generation iPhone SE, both are running iOS 15.5. Also, I can't install the Mac version of Swift Playgrounds, because my OS is too old.

However, my 2020 iPad Pro (12.9") has no trouble submitting apps.

Is there any way to do my coding on my Mac and convert it to a project that can be compiled on my iPad Pro and submitted to the App Store with Swift Playgrounds? The only way I can think that might work is to email the files to my iPad and do a lot of manual cutting and pasting in the editor. That will get old real quick. Do I have any other options? I can't afford to buy a new Mac right now, but hope to when I get my tax refund next year.

williamcousert