SwiftUI on macOS after a week
Last weeked I started reworking my oldest app, Tomato One, in SwiftUI.
What I’m excited about:
- It’s truly rapid prototyping (I’m not working with a DB yet)
- Making layouts is dead simple - knowing Flexbox helps a lot
- Customizing UIs with your own design is very easy
- Sharing simple views between iOS and macOS! I can build my “circle progress view” and easily share it between platforms.
- You can share even more complex views between platforms. But I’m generally against Catalyst approach, I think you should design from scratch for both platforms, and then share what you can (This approach is very easy in SwiftUI too)
Limitations I found:
- I couldn’t create a multi-line
TextField
. I left it as one-line, gave up. - I couldn’t get my
TextField
to focus automatically. There is a Stack Overflow thread about this, and I copied the solution from there. But it’s basically falling back to nativeNSTextField
. - Couldn’t bind “Return” and “Escape” keys to
Button
s. Ended up falling back to nativeNSButton
(StackOverflow thread)
I’m going to keep working on this. It’s pretty amazing. I think I can easily ship this simple app in just a few days.