I keep wanting to be able to write native apps for my devices, and it keeps being true that I can’t wrap my brain around The Way You’re Supposed To Do It. I’ve taken Coursera and Udemy courses on iOS and macOS programming, and I’ve even shipped a couple of toy apps to the App Store, but when it comes to anything real, I find myself getting stuck because the way that the UI gets tied to the model is just so…tight.
This is absolutely not the way to write code for a web application. The whole gosh-darned point of writing a web application is that it’s skinnable, so that your business logic neither knows nor cares how it’s being displayed. I knew this in 1997, and it has only been reinforced by my experience since then.
So anyway, now I have to learn how to write non-skinnable software. It’s like it’s 1985 all over again, in my brain. And lemme tell you, this old guy has never wanted to go back and do high school over.
Okay, so this time I’m hoping it will stick. I’m doing the 100 Days of SwiftUI series from Paul Hudson. I’ve bought several of his books and found them really helpful in figuring out Swift, and I like his style. So, I am feeling pretty positive. But I’m going to go ahead and bring some of my own expertise to the table and on this, the first challenge day, spec out not only the challenge app (a unit converter) but the app that I should write for unit conversion.
Okay, so, first up: challenge. “Build a unit converter app”. The point of this application is to exercise the skills taught in the first demo. Picker, @State, Text, TextField, etc. Okay. Yawn, I’ll do it. But: I’ve already written (in Swift, but not SwiftUI) a unit converter that I would actually use: ThermoSlide. The point, here, is that if you have to select which unit to convert, then type in what value to convert, then select which unit to convert to, by the time you’ve done all that plus launched the app, the moment has passed. When, what’s really more likely is that your wife has set the display to Celsius but you can’t be bothered to learn another gosh darned system at this point in your life and you just want to know how (not) hot to make the car.
Right. So for challenge day of 100 Days of SwiftUI, I’m going to rewrite ThermoSlide as a SwiftUI application. Extra brownie points because I’m going to have to figure out how to make it a watch app at the same time, and while I’m at it I want to reorient the slider so it’s vertical, not horizontal.