Recorded – watch the full episode on YouTube.
What sharp edges stuck out to you when you started using SwiftUI?
Kaya Thomas: Honestly, the thing I struggled with most was navigation. I think navigating from one view to the next is fine, but when you have deep layers of navigation, that's when for me it kind of just fell apart. I experienced a lot of times when it was just not working. For example, I was working on where the code was like three layers of navigation deep. So you have a list, you click on something in the list, it brings up another view. You're in that view, you click on something and then it brings up another view. And a lot of times it just wouldn't work. Sometimes it would work other times it wouldn't work. And that's really frustrating because most apps have several layers of navigation and a deep navigation stack.
“I do think it's great for those like singular views, and building out single views in SwiftUI is really fast and really awesome.”
And so it was really frustrating to know that that wasn't reliable. And honestly, it was one of the reasons why I didn't continue to go deeper and deeper and deeper into SwiftUI, because if I can't get the basics of a navigation stack, then why should I try to continue to invest there?
I do think it's great for singular views, and building out single views in SwiftUI is really fast and really awesome. And then you can use those with UIKit and have the navigation be responsible in UIKit, which I think is a bit more reliable at this point.
Paul Hudson: With navigation, it's a great example of what I call SwiftUI syndrome. Which is you're sitting there coding some SwiftUI and it's brilliant and it's perfect and it works, and you want to do one thing, and you know it's one line of code in UIKit. Like you want to say, get the view controller popped to root view controller, or something like that, right? And you know it's one line of code, but you can't get the view controller. You just want to say, just somehow do this one thing and you can't do it, and you're stuck with it. You end up then saying, “I'll either do without this or have to re-architect to have different solutions, or prep that whole view and make it if you control controller in UIKit.” It's a hard choice to make.
Kaya Thomas: Exactly. It’s a hard choice. I think that's the frustration there: you know how easy it can be to write the SwiftUI code. You see all the snippets that's like, “here, I took this 600-line view controller and turn it into 50 lines with SwiftUI.” And so it feels awesome. And you're like, “oh, I want to do that." But then you hit these roadblocks. So I think that's why I'm hopeful for SwiftUI 2, because I think hopefully a lot of those frustrations and things that we've been having will be solved.
“In actuality it isn't as great as those presentations, but it is really playful and joyful. I think that's one thing that I've really appreciated from it. Even though it has those roadblocks and those pitfalls, it's so fun honestly, to play with.”
Paul Hudson: I think SwiftUI 1, the version we have right now, if I can number this thing, is the ultimate WWDC framework, because it makes for brilliant presentations. But then in practice, you hit these pain points and they sap on a lot of the joy because there's so much joy in SwiftUI. You can do some wonderful, playful, exciting, fun, beautiful things with it. Almost trivially. And then you hit that roadblock and you're like, “oh, I regret my life choices at this point so much.”
Kaya Thomas: I think that's the perfect way to explain it because all of us, I think, were blown away at WWDC because the presentations, it was just so… pow. One line and everybody is like, “ahhh!” In actuality it isn't as great as those presentations, but it is really playful and joyful. I think that's one thing that I've really appreciated from it. Even though it has those roadblocks and those pitfalls, it's so fun honestly, to play with. And it kind of brought me back that joy of when you first wanted programming and you were so excited. Getting things working was just like, “Oh my gosh, it worked.” And it kind of gave me that same feeling.
This transcript was recorded as part of Swiftly Speaking. You can watch the full original episode on YouTube, or subscribe to the audio version on Apple Podcasts.
SPONSORED With Sentry’s error and performance monitoring for iOS, you see mobile vitals that actually matter, can solve any latency issues quickly, and learn how each release is performing over time.
Link copied to your pasteboard.