Swift Playgrounds on the iPad Mini

Week 331 was posted by Charanjit Chana on 2024-02-26.

As I mentioned previously, I am diving into SwiftUI at the moment. It's both enjoyable and frustrating. Working with PHP is very straightforward, in my opinion. Errors are obvious, configuration is easy enough and it's extremely well documented. Not that SwiftUI isn't, but I am not used to the same types of languages so there has been a learning curve.

I don't know if it makes it harder or if the form factor is irrelevant, but I am learning mostly on my iPad Mini. The device is capable but the on screen keyboard makes it tough. You can only see a handful of lines of code and the previews are mostly obscured if writing an app or working on the preset Playgrounds.

With a Bluetooth keyboard, it's better. A lot better, but the real estate is small. I'd assume a full-sized iPad or an iPad Pro would make that all more comfortable, but I have to say it's not impossible.

In fact, I am writing an app using SwiftUI and trying to follow the conventions that Apple has set (which do vary wildly from app to app). It took me a bit of time to understand some of the concepts and when a few things around the ability to abstract components clicked, it all made it much easier.

Swift Playgrounds for iPad

What I really wanted to mention here was that the lessons in the Playgrounds app were really good. They served as a great refresher on programming concepts and set the rules really well for how you write code with Swift. When you're ready to move into SwiftUI, it's not as rich in it's content which would help you dive head first into writing an app, however it's still great for understanding the building blocks.

I actually dived into Swift Playgrounds on my iPad because my Intel Mac is now too old to work with the Playgrounds app. The fact I can still work on it using a comparatively smaller device is a little mind blowing. Even publishing to TestFlight is a breeze.

Comments on SwiftUI

Fetching data should be simpler than it is, a fair bit of the framework feels a little like JavaScript, so some simple methods for fetching data would be welcome.

Apple deviates from their own layout conventions and they add bits of flair, none of which are obvious to me as to how to achieve them.

Not being able to use gradients where you can use colour is a little frustrating, but that feels similar to having to use background images to achieve layouts in CSS rather than relying on inline images in the HTML. This particular point feels solvable.

ChatGPT

When I first embarked on this adventure, I used ChatGPT to get me going. It got me surprisingly far, but with a few lightbulbs going on, that's when I turned to the Playgrounds app.

This feels like the best use case for ChatGPT right now. Searching using Google would have taken me to dead ends or documentation that lacked context. Once I was up and running, I haven't needed to dive back in and ask questions, but nice to know there's a conversational tool that will most likely give me the direction I need to proceed. It's been hit and miss with Google searches over the past month, but I've now learnt enough to navigate the documentation, Stack Overflow and other forums with some sense of what might be useful.

Conclusion

If you have any interest in Swift, SwiftUI or programming in general, then the Swift Playgrounds app is a fantastic way to get started. It's not only somewhere you can go to learn or to build an app. It's both of those and more. Even the autocompletion is pretty good, but it is laggy on my iPad Mini.

Half the time I find errors that get thrown to be quite unhelpful, but overall it's a capable IDE.


Tags: apple, development, ipad mini, swift, swiftui


Tweet WhatsApp Keep Upvote Digg Tumblr Pin Blogger LinkedIn Skype LiveJournal Like