Website loading

Should you use SwiftUI to build your next iOS app?

Blogpost-featured-image
publisher-image
Corina
Chief Marketing Officer
May 7, 2020 β€’ 3 min

Apple announced SwiftUI — the latest framework for iOS that enables mobile developers to build apps using declarative code and little boilerplate.
Up until now, developers and development companies have used a lot of iOS App Frameworks

  • AppKit
  • Bundle Resources
  • Foundation
  • Swift
  • TVML
  • TVMLKit
  • TVMLKit JS
  • TVUIKit
  • UIKit
  • WatchKit

In mid-2019, Apple released SwiftUI and there is a lot of buzzword around it.
Even though SwiftUI only supports iOS 13, it has quite some benefits, both in terms of technology and users’ adoption rate of iOS 13 (more than 80% of people already have it!). 
So, we did our research on it as well and created a list of pros and cons of using SwiftUI for your next iOS application. 

"SwiftUI provides views, controls, and layout structures for declaring your app's user interface. The framework provides event handlers for delivering taps, gestures, and other types of input to your app, and tools to manage the flow of data from your app's models down to the views and controls that users will see and interact with.

Pros of using SwiftUI 

  • You can easily integrate with objects from UIKit, AppKit, and WatchKit frameworks to take further advantage of platform-specific functionality. 
  • Easier customization for accessibility support and dark mode functionality
  • SwiftUI is built to help you easily localize your app’s interface for different languages, countries, or cultural regions. This is a huge advantage, as only 30% of people speak English, and to ensure a better app adoption, you need to customize your app content to your audience culture.
  • The code is extremely clean, simple, and easy to write and read! This helps you keep a tidy codebase even if you have complex features and functionalities, and reduce endless lines of code to just a few simple ones.
  • Most of us use storyboards to develop the app UI, which is great. But SwiftUI is built to help you speed up the process and you can now develop your iOS app UI faster than using Storyboards.
  • While in the UIkit we were writing imperative code — which, basically means you were telling the program what to do (quite like in the real-life imperative), using SwiftUI the code is declarative. A smarter way to code, as you just describe your UI look and feel, and the framework takes care of the rest and figures out what is the best way to do what you want.
  • The time to develop the user interface is optimized now, as there is no need to do as many API calls as it was needed with previous frameworks
  • App architecture. SwiftUI uses Model–view–ViewModel: a software architectural pattern that aids the division of the development of the graphical user interface. This can also be used with UIKit, but it is extremely simplified as well, as you only have to provide your wished data/state and the framework automatically takes care of observing and updating the views. 
  • Engaging apps use 3D animations, gestures, a lot of trending effects, and context menus. And SwiftUI is here to support developers in simply implementing them.
  • App simulator. While we code all the needed app features, developers re-run the app on multiple devices or simulators to see if everything goes smoothly and according to the plan/requirements. And SwiftUI has Xcode Previews, so you can see the UI right from the editor, streamlining the edit-debug-run cycle into a seamless workflow.
  • Refactoring UI. From time to time, we have to refactor our code and our UI to ensure a better experience for the user (be it in terms of speed or usability). And the good news with the new iOS framework is that if your code is getting (too) long, you can easily get a good grasp of it and pull out subviews for refactoring.

Cons of using SwiftUI

  • As it happens with any new technology, device, or even framework recently after launch, there is a lack of documentation. And, for developers, documentation is like the bible of coding. And when we do not have enough documentation, we tend to check StackOverflow and see if other fellow developers faced the same challenges. But when it comes to SwiftUI, there is neither enough documentation, experience in the field, nor enough apps developed with it to see how it works and challenges we might encounter.
  • While clean code is what we all aim for, SwiftUI can easily create nested code because of all loops and conditionals, but to improve readability you’d better break down the views into smaller, composable blocks of code.
  • Basic functionalities are missing: with SwiftUI one cannot hide the navbar, display a modal in full screen, nor remove list separators.
  • Complex tasks and functionalities are missing good code examples within the documentation provided by apple
  • Error messages. We are all familiar with them, and as much as we dislike them, they should be really informative and tell us what went wrong. Within SwiftUI, the error messages can be misleading sometimes. 
  • All apps built using SwiftUI will only work on iOS13, and we usually approve frameworks that work for at least 2-3 of the latest versions. But then, again - if you build your app now for iOS13 you are set for the next versions as well and the framework will be way more stable.
  • Being a newly-released framework, it is not stable yet and there are still some bugs (e.g., custom fonts are not properly rendered)

Should you use SwiftUI for your iOS mobile app?

It may have a lot of cons at the moment, but iOS is here to stay, and so are the apps! We definitely think SwiftUI has a lot of benefits and it can save a lot of time and costs in terms of app development. And while there are still bugs and lack of documentation, the framework enables developers to easily build the most needed functionalities for a more customer-centric approach. 
And the documentation will definitely be more verbose, provide more examples, and ensure stability in the near future.

Want to build an iOS app and no idea how to start?
We help entrepreneurs like you quite often (and here is the Wolfpack Digital portfolio to prove it). Drop us a line in the chat or via e-mail about your plans and we will guide you from idea to the app launch!

tech insights & news

blog

Stay up to date with the tech solutions we build for startups, scale-ups and companies around the world. Read tech trends and news about what we do besides building apps.