I’m still learning SwiftUI.
Learning something new is hard. I taught myself programming by typing random commands into HyperCard on a Mac SE. After that, I did REALbasic. When I was 14, I started learning Cocoa using whatever Apple tutorials and sites I could find online. It was a struggle. No one had taught me about classes, polymorphism, or memory management. I wrote a lot of bad code long before I wrote a lot of good code. But I stuck with it because Cocoa seemed like something special. And it was.
Digging into SwiftUI this week gives me same feelings of being lost in something new, and looking at the future.
New things can make everyone uncomfortable sometimes. I’ve worked in AppKit for 18 years and UIKit for 10 years. I know right now there are probably a lot of programmers that haven’t even graduated high school yet that can write far better SwiftUI than I can. It’s hard to go from being an expert one day to being a novice the next. I think a lot of developers might feel that way right now too.
Earlier this week, The Verge posted an article arguing that Apple should make nearly all of their Mac apps Marzipan apps. The idea was that it might hurt the Mac in the short term, but in the long term would make the Mac a better platform.
I use a Mac to get my work done every day. I spend more time with a Mac than I do nearly anything else in my life. It’s not that I don’t like the iPad. I love my iPad Pro. But I don’t want to see the tool I use every day get worse. I don’t want to have to see the Mac lose for the iPad to do well.
SwiftUI is amazing because it doesn’t feel like there are any losers. It makes the Mac better. It makes the iPad better. It makes the iPhone better. Heck, it even makes the Apple Watch and Apple TV better. I’m thinking about ways to ship apps for the TV and Watch, and I never would have considered that before. I even have Mac apps I might bring to iPad. I didn’t want to give up the power of AppKit on the Mac, and I didn’t want to maintain two separate code bases. Now I don’t have to choose.
AppKit and UIKit are going to be around for a while. Carbon was finally removed in Catalina, 13 years after its deprecation. And AppKit and UIKit are probably a long way from even reaching deprecation. It’s very likely both these APIs will be around in some form for at least a decade, probably longer.
SwiftUI is also very young. It’s amazing for a 1.0 API, but it’s still 1.0. Features that are missing will be added. I expect other Apple frameworks to also become become more reliant on and cleanly integrated with Combine and SwiftUI as time goes on.
But none of that diminishes how powerful SwiftUI already is today, and how effortlessly it can integrate into the code I ship. All with the platform features I need to support.
This is going to be new for everyone. I’m probably going to write some bad code, and I’m probably going to say some stupid things on Twitter. I’m not always going to be a smart guy on the internet (assuming I was before.) But that’s ok. Because it’s all part of getting somewhere better.