2020 has been a crazy year, right?
We have witnessed ups and downs in so many industries. But today, let’s talk about the good things. For instance, mobile app development is booming with demand rising as high as $189 billion dollars in 2020. This spurt in demand is due to the rise in app development in all kinds of sectors such as ecommerce, entertainment and education, to name a few.
If you are looking to leverage this opportunity and target the iOS platform for your next mobile app, then keep reading.
Earlier, whenever we talked about iOS app development, the only name which came to our minds was Swift. However, due to the budget constraints faced by small businesses or startups, they opt for a new solution known as Flutter app development. It has recently gained immense popularity and is completely different from native Swift app development. Here is an overview of both these platforms.
A programming language developed by the Cupertino giant itself, Apple’s Swift is a modern, rapid and type-safe programming language. The best feature about Swift is it’s dynamic nature which ensures that the language is constantly evolving with the changing trends. Swift provides it’s global community of developers with efficient tools, documentation and exceptional frameworks which makes native iOS app development easy and smooth.
Contrary to native app development as done by Swift, Flutter is an open source software development kit which can be used to make both iOS and Android apps from a single code source which uses Dart language. Launched and maintained by the tech giant Google, Flutter has emerged as a great choice for hybrid app development.
But since we are discussing iOS app development, a vital point is that Flutter closely represents React Native, a popular iOS development platform. Flutter is even better than React Native since it has support for all the native features and provides great documentation as well.
Let us now take a look at the popular Flutter vs Swift battle based on the following parameters-
The Onboarding Process
While developing iOS apps using native tools such as Swift, you’ll require Xcode as the IDE. The basic development kit is included in Xcode itself. For this purpose, you will need a MacOS device with Xcode installed in it. After that, you can just start a new project with your app’s name and select Swift as the programming language. Once all the required details are filed, Xcode will build you the iOS template code and you are good to go.
For Flutter iOS development you will need Xcode plus something known as Flutter binary. Once the setup is complete, there are a few commands you can run such as the native-compare which will give you a description of the Flutter project. After applying the Flutter raised button widget, you can run your app with the command $ Flutter run.
Hence, the onboarding process for Swift iOS development proves to be less cumbersome with fewer configurations than iOS app development with Flutter.
Development & Build Time
When it comes to Swift, you can easily measure the build time of your application using the xcodebuild command line tool or simply Xcode itself. In order to know the build time for clean builds, you can also delete the build folder or derived data. Erasing these is a simple process. A clean build tool takes about 13.33 seconds whereas consecutive builds take less than a second.
Coming to app development using Flutter, users can apply a given command in debug mode to erase all derived data and thereby get a clean build time. It takes almost 33 seconds for a clean build and then 10 seconds, 8 seconds, etc. for consecutive builds. Taking into account everything, a clean build takes anywhere between 30 to 45 seconds.
Therefore, Flutter takes considerable time for a clean build as compared to Swift which is relatively faster. However, if you take into account incremental or additional development then Flutter gets the upper hand since the build time for that in Xcode is supremely fast.
The testing procedure on a simulator or device when changes have been made to code, is known as app reloading. It is an important aspect of mobile app development.
When you are dealing with a native iOS app built using Swift, then for even making a minor button change you need to rename it from the StoryBoard. This will most likely require a change in data and accessibility features too. After the said change has been performed, you need to rebuild the application and check it on your simulator. Doing the whole procedure via Xcode will take you about 7-12 seconds. Not bad, right? Wait till you hear what Flutter has up its sleeve.
In order to make the exact same change we made in the app built using Swift, Flutter will require only 3 seconds, owing to its amazing Hot Reload feature. It helps you make changes to your app as per feasibility and can be seen on the simulator almost instantly.
So in terms of app reloading speed, Flutter clearly takes the cake.
Profiling is basically a dynamic procedure which involves the analysis of several functions of the app such as CPU, resources and memory. Both Swift and Flutter offer good support for app profiling.
In case of Swift app development, you can directly profile an app from Xcode. It introduces an instrument app that measures your app through several criterias. There a number of templates to choose from such as the Time Profiler for instance gives you an analysis of CPU threads.
Coming to Flutter, it has great documentation on app profiling using IDE or command line. Since profiling is such a huge task, there are various flavours available for benchmarking in Swift and Flutter alike. Both of them have great support for profiling as well as debugging iOS apps which is why it is difficult to pick one winner. Swift has a dedicated app Xcode whereas Flutter uses the lightweight browser for profiling.
Swift has a dedicated framework known as UIKit for the purpose of accessibility so there is no need to import a separate framework. Apple also offers an Accessibility API but for that developers need to offer accurate data for each UI component in the iOS app which utilises the UIAccessibility protocol. With the help of code, you can add various accessibility tools such as identifiers and labels. There is also the option of using StoryBoard and interface builder for offering accessibility features to users.
Flutter applications unfortunately don’t have support for adding accessibility features that Swift does. There is only the option of measuring iOS apps by using the Accessibility Inspector tool provided by Xcode. The issue of adding accessibility identifiers for testing is still a work in progress.
Therefore, Swift offers much better accessibility features for persons with disability to use native iOS apps. Flutter should plan to add these features in the near future.
Testing & Documentation
Swift is a great choice for native iOS testing since Apple provides a comprehensive platform known as XCTest for various kinds of testing such as UI, performance and application testing. It is a very efficient platform with a wide range of testing tools updated frequently by the experts at Apple as a part of the iOS app development package. However, it lacks features such as grouping of tests, snapshot testing and data-driven tests.
Flutter offers a robust testing system which ensures that the developers can easily write clean, error free code from the very beginning. It offers a host of other features too which make both functional and unit testing much more useful. There’s also a dedicated Flutter driver which runs all the tests successfully. It is also great for a rapid documentation process.
The Final Verdict
Every Swift vs Flutter discussion leads to one common conclusion that both these platforms are a great choice for iOS app development. The individual choice would differ from person to person as per their requirements. Swift might have been the go to choice for iOS app development for many years but Flutter has made its entry with a bang. It outperforms Swift in many cases such as testing and app reload speed. It has the capability of building apps which are very close to native apps but at a much lesser price. The fact that Flutter also supports Android with the same source code is a big added advantage which cannot be ignored.