Why Should iOS Developers Pay Attention to Flutter

Mar 9, 2019

Every day there are thousands of new mobile apps landing on the App Store.

While companies are looking for options to develop apps within a short time and limited budget. The native mobile app development for iOS or Android always requires two different tech stack which results in the two different teams and higher cost. This is the reason, companies started looking for the cross-platform solutions. The popularity of the React-Native framework is one of the examples of this fact. There is another cross-platform mobile development framework booming in the market recently which is a Flutter. In this post, we will see the potential impact of Flutter on native iOS development and why iOS developers should pay attention to it.

What is Flutter

Just in case, if you haven’t heard about Flutter. Flutter is an open-source, multi-platform, mobile SDK which can be used to build iOS and Android apps with the same source code. Flutter was around since long. But it has started getting more attention since Google I/O 2018 when Google announced release preview of Flutter. At the Flutter Live on 4th December 2018, Google announced the first stable version of Flutter with loads of new features. There are some big companies like Alibaba already started adopting Flutter for developing mobile apps. At the moment, you can see Flutter as React Native but with the full support of native features. If you’re curious to learn more, check my detailed comparison of the Flutter vs React Native.

Flutter vs Native iOS App Development

The native iOS app development has become more interesting especially with the rise of the Swift programming language. The apps developed with native technologies especially Swift are very slick and fast. On the other side, the apps developed with cross-platform solutions can be easily spotted and it feels like there is something missing. However, since Flutter apps landed in the App Store, there is no way to spot that the apps were built with Flutter. The apps feel so slick, native and smooth. So what’s in the Flutter that makes apps to feel more or less native.

There are already some great articles on Flutter. One of them is known as ‘Flutter will change everything and is an excellent choice for iOS development’ by Andrea Bizzotto which is detailed and bit controversial article. There is another one on `Native Developers View on Flutter` . Looking at all these articles, it’s clear that iOS developers cannot ignore Flutter.

Flutter is surely different than the native iOS development tools. The official documentation has a clear guide on the Flutter for iOS developers. This guide describes how the native iOS development concepts map to the Flutter.

Let’s compare Flutter with Native iOS Development using some basic criteria

  • Technical Architecture
  • Developer Productivity
  • UI Components
  • Testing Support
  • CI/CD Support

Technical Architecture

The tech stack used for the native iOS development and Flutter is completely different. Flutter is being developed openly by Google and native iOS development tools are being developed secretly at Apple. The only exception to this is Swift and some other libraries available on Apple’s Github. Flutter uses Dart as a programming language while native iOS development uses Objective-C or Swift. The IDEs are also different — native development is normally done in the Xcode while Flutter apps can be developed with IntelliJ Idea, Android Studio or any other text editors like Sublime Text or Atom. As we know, the native apps built with Swift are slick and fast as all the components built natively. Flutter uses the Dart framework and often does not require the bridge to communicate with the native modules. The architecture of the Flutter engine is explained in detail in Github Wiki here. In short, Flutter has everything needed for native app development in the Flutter engine itself.

Developer Productivity

While developing the apps natively, iOS engineers need to use the Xcode and native frameworks provided by Apple. Everytime developer makes changes to the app, a developer has to rebuild the app or third-party dependencies in some cases to see the changes in the simulator or the devices. As an iOS developer, you might have experience of this slow process. In Flutter, there is a hot reload option, when a developer makes any changes, the changes appear in the simulator or devices instantly. However, as the app grows in size developers need to adopt the new techniques to use this feature effectively.

The dependency management for the iOS still depends on the third-party tools like CocoaPods or Carthage which has its own pros and cons. The iOS developers need to learn about these third-party dependency management tools. Flutter uses its own dependency management system called Pub. The Pub Package manager is inbuilt with the Flutter apps so that it’s easy to get the new dependencies as needed for the development.

On another note, Dart is not a common programming language and there is a lack of support for it in many IDEs and text editors. It may be a steep learning curve for the developers to learn the new language. While Swift is getting mature and grow on the server side as well, it has autocompletion and other developers friendly support in Xcode.

UI Components

The most of the time iOS developers spend in building the UI. The native framework provided by Apple is called UIKit which has all the event-driven user interfaces with a wide variety of the gesture support. The UIKit framework has native support for the animation, document, drawing, and printing. Flutter UI engine is different, Flutter apps run on the Flutter rendering engine and Flutter framework. Flutter uses the concept of the Widgets which can be used to build the complex UIs. In short, the Flutter UI is basically a tree of stateless or stateful widgets. There are loads of the widgets in the catalog available to build the complex UI which supports both Material Components for Android and Cupertino for iOS. The Flutter layout and widgets are pixel perfect as well.

Testing Support

Apple has provided XCTest native testing framework for unit, integration, performance and UI testing of iOS Apps. Apple is continuously improving their testing frameworks and tools every year. The XCTest is proving to be the great framework for testing native iOS apps with Swift. However, the native XCTest framework lacks data-driven testing, the grouping of tests, snapshot tests or some other features that have been provided by xUnit testing frameworks like JUnit. One of the pains of using XCTest is stubbing and mocking especially with Swift. The mocking with protocols requires lots of code and there is no native support for stubbing. When it comes to UI tests mocking/stubbing gets even harder.

On the other side, Flutter provides a solid testing framework which allows developers to write tests at the unit, functional and UI level. Widget testing is one cool feature that Flutter provides to run UI tests as fast as unit tests. Flutter has cool [documentation]() on how to test Flutter apps at different levels with example code. Flutter integration tests are similar to Xcode UI tests which go through the UI to perform specific operations. The Flutter integration tests run in a separate process and can be run on real devices or on simulators or emulators. Flutter provides a separate package, Flutter Driver to drive these tests.

CI/CD Support

The Continuous Integration and Continuous Delivery practices enable the faster delivery of the iOS apps. Apple provided the Xcode Server for Continuous Integration and Delivery of the native iOS apps but Xcode Server approach isn’t scalable for the wider teams. Apple also acquired BuddyBuild to provide scalable services. There might be something new in the near future for native CI/CD of the iOS apps. Currently, most of the teams use a combination of the Fastlane and Jenkins for the in-house CI/CD or outsource it to the cloud vendors like Travis CI, CircleCI or Nevercode etc.

On other side, Flutter teams at Google partnered with Nevercode and announced Codemagic CI/CD solution at the Flutter Live, London. Codemagic is the painless CI/CD solution developed at Nevercode which automatically detect, build, test and package the Flutter app with zero configuration.

By comparing the Flutter and native iOS development tools, we can’t conclude which is the best as it totally depends on the project, company, budget, and context.

Is Flutter Perfect?

Flutter is full of feature set but it’s definitely not perfect yet. There are some important features of iOS app development currently lacking in Flutter like OpenGL, Maps, Video support and Accessibility support. There might be some other features missing as well. Flutter has just landed first stable release. Flutter has a long way to go to be perfect and comparable with native tools but their roadmap, goals are clear and the community is growing dramatically. So it’s just a matter of time.

Potential Impact of Flutter on Native iOS App Development

Now that, we have done a brief comparison of the native apps and Flutter apps. Flutter is still a new and long way to go but we have seen that it’s growing faster. We can’t conclude whether Flutter apps are better or native apps are better. Anyway, Flutter is an option for the business to develop native’ish iOS and Android apps with same source code and with fewer resources.

As of now, there are so many cross-platform mobile app development frameworks came and gone still native app development remain the solid choice for developing mobile apps. However, Flutter seems totally different than all other cross-platform solutions. Futter apps look native and slick just like the native apps. As an iOS developer, you shouldn’t ignore Flutter. We can’t predict the future but who knows Flutter will be the first choice for the business to develop mobile apps. Some of the articles online indicate that companies already started porting their native apps to Flutter. The good article is porting a 75-000 line native ios app to Flutter explain the process of migration. Flutter is clearly changing the views of the cross-platform mobile app development because of ease of development, test and release the mobiles apps.

The cross-platform development is expected to reach the height in the coming years. Some experts already predicted that Flutter will be the future of the mobile app development. Whether to pay attention to Flutter or not is a personal choice but it’s safe to say that Flutter has entered in the cross-platform app development race so strongly and it’s here to stay for long term.

Conclusion

Flutter is hot at the moment in the market since Google announced the first stable release. Looking at the Flutter features there are lots of questions flowing though minds. Will companies go for Flutter as the first choice of developing apps? Is it beginning of the end of native mobile app development? Will Dart replace Swift and Kotlin? Should iOS Developer start learning Dart?

No predictions or guesses but it could be the alarming bell for the native mobile app developer that something like Flutter might affect their role in the future or maybe not. Love Flutter or Hate Flutter, you can not ignore it anymore.

Codemagic CI for Flutter