Native iOS with Swift vs. Flutter from iOS developer perspective

Native iOS with Swift vs. Flutter from iOS developer perspective

Which one should you go with?

Intro

Back in 2020, after two and a half years of working as an iOS developer, I got a chance to work with Flutter. Even though I had been enjoying working with Flutter very much, I decided to go back to native iOS only after four months. I've given my best to explore the platform in those four months. In this blog post, I summarized my thoughts about Flutter.

If you develop mobile apps or you are a beginner and aren't sure whether to learn native iOS or Flutter, this blog post can help you decide.

And if you are a decision maker and you are thinking about going with Flutter to cut costs, skip to the paragraph "Should I use Flutter for my next project?".

Disclaimer:

Before I dive into my thoughts on Flutter, I must disclose two things. My opinions might be biased towards native iOS development since I'm a big Swift fan and I chose to go back to native iOS development. It's been a while since I've worked with Flutter, so some information might be outdated. If that's the case, feel free to correct me so I can update this article.

Flutter pros

Flutter pro #1: Cross-platform development speed

Mobile cross-platform development can be much faster than developing two separate iOS and Android native apps. It depends on your use-case and if you use platform-specific APIs.

Flutter pro #2: Autocomplete

Reliable code completion and Xcode can’t fit in the same sentence. But Flutter apps are developed using Android Studio or VS Code. Both offer fast and reliable code completion.

Flutter pro #3: Declarative programming

Declarative approach in Flutter makes creating UI layout a pleasure. Sure, iOS is catching up with SwiftUI which also makes creating UI declaratively possible in iOS. Actually, I use SwiftUI on a daily basis for creating my own indie app. But, a lot of existing iOS projects are still using UIKit for most of their UI, and UIKit is imperative. But SwiftUI still doesn’t support all of iOS APIs. Also, there is still a lot of legacy UIKit code in existing apps that are not brand new.

My favourite thing about declarative programming is the ease of extracting widgets (views in SwiftUI). That way, it’s simple to create reusable components and makes UI code much more readable. Also, it makes easy to use existing UI components on other projects. It can make creating apps with similar design less expensive.

Flutter cons

Flutter con #1: Performance and app size

Flutter uses a virtual machine (VM) to run on iOS. It makes your app's size bigger from the start, as your app needs to include code for this virtual machine to run.

IDEs used for Flutter development need more resources to run on your device. As Xcode is natively built for MacOS, it requires less resources.

Flutter con #2: Platform specific use cases (need for native API frameworks)

When working with Flutter, for every platform specific use-case, you need to use a plugin. You can use existing open-source plugin, if it exists, or you can create your own. When using plugins, you depend on how well they are maintained, and a lot of them are not well maintained.

If you are creating your own plugin, it takes more time in comparison to doing it natively in the first place, because it includes native logic + bridging logic. For applications which are dependent on native API frameworks like ARKit or Core Data, going with Flutter doesn't make much sense at all.

Flutter con #3: Dart language

Swift is one of the programming languages with the nicest syntax.

Comparing Swift's and Dart's syntax could take a whole another article, but I'm going to write a few reasons why I prefer Swift:

  1. Swift doesn't require semicolons ; . If you write semicolons in Swift, you are probably doing something wrong.

  2. Swift looks like a modern language, and Dart doesn't. Swift has a lot of options for syntactic sugar that makes the code much more pleasant to read and write, like Nil Coalescing Operator and Optional Chaining.

  3. Enums in Swift are super powerful with support for Associated Values and Raw Values. I missed Swift's enums very often when I was writing Dart.

The only way Dart was better than Swift was it's support for async await, but Swift also added support for async await since the release of iOS 15, so this advantage is gone.

Should I use Flutter for my next project?

If your budget is very tight, and you need to build a prototype as fast as possible, Flutter might be a great solution for you. For most use-cases Flutter lets you build an app for iOS and Android with fewer resources than going with native app development.

But if you want to build a product with a best quality achievable, for iOS app development, there is no other way to do it other than sticking with native. Native iOS development will give you most stable application, best performance, smallest app size, and many other benefits.

Conclusion

Flutter is the best cross-platform mobile app development solution yet. But as any other cross-platform framework, it has some unavoidable downsides. If you are considering embracing Flutter in your life, you should be aware what it will bring you. And if you want to go with a safe bet, stick with native.


Follow my journey as an indie iOS developer on Twitter 😊