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

  Рет қаралды 2,482

JohnDav

JohnDav

Күн бұрын

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
ZER0ED: apps.apple.com/us/app/zer0ed/...
Shapes&Numbers: apps.apple.com/us/app/shapes-...
My Website: www.johndav.com

Пікірлер: 24
@ChileMamaLC
@ChileMamaLC 2 жыл бұрын
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.
@John-Dav
@John-Dav 2 жыл бұрын
Yeah hopefully they’ll bring some kind of conversation into this in the future. I can definitely see it being easier staying with SwiftUI on both since you won’t be reworking as much code.
@andrewhall8757
@andrewhall8757 2 жыл бұрын
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. 🙂👍🏻
@John-Dav
@John-Dav 2 жыл бұрын
Well at least it makes me feel a bit better to know that I wasn’t crazy when I couldn’t find a simple solution anywhere. But man - Apple really should fix this! Glad to hear you’re project is coming along and expanding. Always great when things come together.
@ChrisLaupama
@ChrisLaupama 8 ай бұрын
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.
@Rolvr
@Rolvr 2 жыл бұрын
Great video!
@creelfo
@creelfo Жыл бұрын
Is there way to do this the other way around instead of converting an Xcode to a playground file?
@John-Dav
@John-Dav Жыл бұрын
Assuming that your Xcode project doesn't rely on features exclusive to Xcode I guess you could do the same process in reverse. I guess you could probably even do this inside of xcode on your Mac (just create a playground file there) then transfer the entire playground project to an iPad if that's the end goal.
@alejmc
@alejmc Жыл бұрын
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 bindings/state-vars/state-objects/etc 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.
@John-Dav
@John-Dav Жыл бұрын
I'm starting to really see Swift Playgrounds in particular as a place for rapid prototyping on the go and I'm happy that it seems to be finding it's place in the larger programming communities out there. I hope that Apple has plans to keep building this out further. I'd love to see more capabilities in the future. Happy you found my content useful. Thanks for stopping by!
@katielong1720
@katielong1720 Жыл бұрын
Can you go the other way? Can I change an Xcode file to open in Swift Playgrounds?
@John-Dav
@John-Dav Жыл бұрын
As far as I know the only thing you can do is copy/paste the code into a new swift file. However there are some things that Swift Playgrounds can’t do so depending on your Xcode project it may not work.
@Rolvr
@Rolvr 2 жыл бұрын
Apple needs tô unify playgrounds and Xcode files or just release Xcode on iPad too.
@John-Dav
@John-Dav 2 жыл бұрын
Yeah at the very least you should be able to convert a playgrounds package into an Xcode one if you decide you need the more capable solution after the fact.
@williamcousert
@williamcousert 2 жыл бұрын
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.
@John-Dav
@John-Dav 2 жыл бұрын
Interesting I hadn’t really ever thought about the need to go from Xcode to Swift Playgrounds. Unfortunately I don’t think you have many options. With a newer Mac copy and pasting or even drag & drop files would likely work between the two devices but idk if your Mac would be able to support these features. Even if it did though you’d still have issues with the Xcode project containing a lot of extra stuff that the swift playgrounds project can’t access. Going from Swift Playgrounds allows you to add those missing Xcode things in, but i think you’ll run into issues trying to get the swift playgrounds project to compile without the files from Xcode. Again - another reason apple should build a tool for converting these two project files. Sorry I couldn’t be more help! Good luck on your search.
@williamcousert
@williamcousert 2 жыл бұрын
@@John-Dav I wonder if it would be hard to create a utility that would convert projects between Xcode and Swift Playgrounds. Does Apple publish the file formats for both project files?
@John-Dav
@John-Dav 2 жыл бұрын
It'd be an interesting project to attempt, but I'd expect that you'd run into some "You just don't have access to this" type of situation. I know another commenter on this video confirmed, after speaking with an Apple Developer at WWDC22, they haven't developed a tool for this and that the current best practice is to just copy/paste files. But that's for going from Swift Playgrounds to Xcode, the reverse might work too, but since there are things that work inside Xcode that don't work inside of Swift Playgrounds you might have more problems - especially if your Xcode project has capabilities available only inside Xcode like IAP functionality for example. An upgrade might be your only real option which sucks. :(
@williamcousert
@williamcousert 2 жыл бұрын
@@John-Dav I plan to upgrade as soon as my finances improve, hopefully around tax time, if not sooner. I just need something that will work until then. I'll limit my code to whatever Swift Playgrounds is capable of supporting. I just need an easier way to move it back and forth between the two programs. I have a few ideas that I'm going to try, and if I find something that works, I'll post again.
@John-Dav
@John-Dav 2 жыл бұрын
@@williamcousert Please let me know if you find anything that's successful and good luck in the search!
@isakarasac5314
@isakarasac5314 Жыл бұрын
please upload the videos in Turkish translation
Каха ограбил банк
01:00
К-Media
Рет қаралды 11 МЛН
OMG🤪 #tiktok #shorts #potapova_blog
00:50
Potapova_blog
Рет қаралды 18 МЛН
Making iPad Apps... on the iPad!
6:45
Rene Ritchie
Рет қаралды 88 М.
Swift Playgrounds: A Promising Start For Hobby Developers
4:57
What is happening with Flutter
3:41
typecraft
Рет қаралды 141 М.
Push Notifications are NOT what you think
0:27
Philipp Lackner
Рет қаралды 25 М.
Moving Swift Playground Apps to Xcode
28:58
The Code Hub
Рет қаралды 114
Blender Python VSCode: print() statement output
0:21
CG Python
Рет қаралды 3,1 М.
Fun With Swift Playgrounds | CopyPasta Extravaganza!
41:25
Blue Mobile 📲 Best For Long Audio Call 📞 💙
0:41
Tech Official
Рет қаралды 1 МЛН
Мой инст: denkiselef. Как забрать телефон через экран.
0:54
ПОКУПКА ТЕЛЕФОНА С АВИТО?🤭
1:00
Корнеич
Рет қаралды 3,6 МЛН