Pushing SwiftUI To The Limit

Veronica Ray
Compass True North
Published in
3 min readOct 8, 2019

Apple’s Worldwide Developer Conference on June 3rd was around the corner, and I planned to pick my topic for my SwiftTO talk after I heard the announcements. Fortunately, this year’s conference was thrilling. One announcement was a declarative UI framework called SwiftUI.

SwiftUI would make it much easier to build apps for all Apple devices. A lot of iOS teams (including Compass) build all their iOS UI in code because Storyboards often lead to merge conflicts and changes to Nibs are difficult to code review. Nibs are individual user interface files that you create in Xcode’s Interface Builder, a drag and drop way to build UI in iOS. Storyboards are similar to Nibs but can contain multiple views and the flows between them. With SwiftUI you don’t have to choose between all these options. You use a drag and drop interface in the Xcode IDE to update your UI and it automatically updates the corresponding code. You also get a live preview of the view you’re currently working on.

During the developer keynote the Compass mobile team gathered in a conference room. We were impressed by SwiftUI and excited about the possibilities. But we were also concerned that SwiftUI wouldn’t be able to handle more complex apps.

At this time I was deep in agent MLS filters. This project brought multiple listing service (MLS) search filters to mobile. I had just built a custom range slider component that would be the perfect candidate for SwiftUI. This component allowed agents to quickly set ranges for search criteria like price and lot size. It required lower level graphics programming with Core Graphics and complex sequenced gestures. I converted the component to SwiftUI and gave a talk about the experience titled “Pushing SwiftUI To The Limit.”

In my talk, I discuss how I wasn’t always an early adopter. I only became an early adopter this year when I joined Compass. The mobile developers here learn from iOS, Android, web and other platforms. SwiftUI was a massive announcement in the iOS world but it has many similarities to the cross platform mobile framework Flutter and React on the web.

I downloaded the beta version of MacOS on my personal computer. I broke down the larger project into smaller milestones and didn’t give up in the face of incomplete documentation, beta software and a lack of examples. I show each milestone in my project, from the most simple gestures to the final component. I show where I got stuck and how I got unstuck. I strove for deeper conceptual understanding rather than quick wins because I believe that leads to sustainable long term progress.

Can SwiftUI handle complex custom UI? Yes. During my project I discovered another barrier to adoption: SwiftUI is not open source. While the iOS community has developed many techniques to better understand Apple’s closed source frameworks, the wider developer ecosystem is moving towards open source. Knowing what’s actually happening under the hood is crucial for developing a #QualityFirst iOS application that real estate agents can rely on. Apple should open source SwiftUI like it has open sourced Swift if it doesn’t want to lose ground to Flutter and React Native.

--

--