The Swift Playgrounds app really hasn’t gotten any love[1] since it was first introduced. You can actually import UIKit and the other frameworks and compile them on the iPad but this is pretty much undocumentated. The preview views are tremendously buggy (really the whole app is) and there is all sorts of hidden debug stuff running in the background[2] that slows down performance. Everything has to be in a single file so doing anything moderately complicated is a pain, the editor is buggy and will sometimes highlight just the last three letters of a word, and there is no Interface Builder[3]. I would love a real XCode.
[1]There have been new playgrounds added (e.g. “Learn to Code with Swift”) but the app itself really hasn’t been changed at all. The same bugs have been present for years. And they aren’t obscur either. You will run into editor bugs within the first 5 minutes.
[2] The debug stuff is to help facilitate the different playgrounds, but doesn’t really provide any benefit to someone coding in a blank file outside of a playground. You can’t turn it off within the app.
[3] I know a lot of people don’t like IB, but it’s great for throwing together simple apps quickly. It’s odd that it is absent from the official apple App but Pythonista, an app made by one person, has an visual interface editor.
The UI has been changed slightly.
> You can actually import UIKit and the other frameworks and compile them on the iPad but this is pretty much undocumentated.
Well, it's UIKit. You can just pull up the documentation at developer.apple.com.
> The preview views are tremendously buggy (really the whole app is) and there is all sorts of hidden debug stuff running in the background[2] that slows down performance.
The app is very buggy, but the debug stuff cannot be turned off because it's compiled into the code you write.
> Everything has to be in a single file so doing anything moderately complicated is a pain
No: you can add additional files to the "Sources" folder. This is how Apple's tutorial playgrounds work.
Also, my complaint was that you cannot turn of the debug stuff. You actually can if you turn off things like logging in a template file on the Mac and then move that to the ipad. At that point you might as well just use the Mac though. See here for what I’m talking about. http://saltpigmedia.com/blog/Modules-in-Swift-Playgrounds
Also, as far as I am aware, you cannot add to the sources folder on the iPad itself. That requires a Mac.
My comments were in regard to using Swift Playgrounds as a pseudo-Xcode. It does indeed compile swift code and UIKit, so a lot of that groundwork is there. And I would love to use the iPad to do real coding, and Swift Playgrounds is real tempting, but it just doesn’t work and I find that disappointing.
A couple of the example playgrounds expose this.
> Also there is little documentation that explains things like XCPlayground and PlaygroundsSupport.
Documentation is available here: https://developer.apple.com/documentation/playgroundsupport. It's not great, but it's getting better.
> Also the limitations on Swift Playgrounds are never mentioned anywhere (e.g. autolayout constraints don’t really work for the Playgrounds previews.
They do, but in a buggy way. I have long considered this to be a defect and have filed Radars about this.
> Also, as far as I am aware, you cannot add to the sources folder on the iPad itself. That requires a Mac.
You can create playgrounds on the fly with the Files app, if you know the structure they must have. You cannot edit them in Swift Playgrounds.