As a developer who has only worked in React, React Native and Vue, I have been itching to explore more frameworks and languages so that I can 1) Be a more well-rounded developer, and 2) Have more meaningful and in-depth conversations with other developers. However, the list of JavaScript frameworks seems to grow longer each day, and learning another language is exciting but daunting. Where do I start? I feel like a kid who has never been in a candy shop before; there are so many options and I simply don't know which to choose first!
Over the past few weeks I have been building my first mobile application in React Native working in VSCode. The rumors on the internet/develper scene is that very few mobile platforms are built utilizing React Native, and that Flutter and Swift are the way to go. Since I've owned Apple products most of my life, I of course lean towards Swift, but what are the pros and cons? Why should I choose Swift over Flutter?
Here's the little that I know going in: Swift is "a general-purpose, multi-paradigm, compiled programming language created for iOS, OS X watchOS, tvOS and Linux development" that was created by Apple. (Source) I also know that people like Flutter because it is cross-platform compatible, meaning it works well on both iOS and Android devices which would eliminate time and seemingly increase efficiency.
Here's what I found: Flutter is open-source and uses the programming language Dart. Therefore, I would have to learn both Dart and Flutter. Swift is also an open-source project, but is a type-safe programming language that is incredibly fast (hence the name), but you have to use developer tools and frameworks by Apple, like Xcode. To build an app with Flutter, you can use seemingly any IDE you want, as long as you have the Flutter binary installed. (Source) There are far less resources available to developers for building a native iOS application using Flutter, whereas Swift seems to have far more documentation available. Flutter also takes longer on the intial build than Swift, according to a native iOS application build comparison found here.
Also, Flutter has a hot-reload feature, unlike Swift which needs multiple changes within the app to trigger a re-render, and can take up to 7-12 seconds to rebuild and re-render those changes. In terms of Accessibility, Swift takes the cake. Swift does not need an accessibility framework to be imported, and accessibility identifiers and labels can be implemented as such:
button.accessibilityIdentifier = "Press Me"
button.accessibilityLabel = "Press Me"
There is also apparently the option to use the StoryBoard and interface builder, which seems like an incredible additional tool for developers in seeing all available accessibility options. In stark contrast, Flutter currently does not have any "mature support to add accessibility; Flutter documentation suggests to audit iOS apps using XCode's Accessibility inspector tool." (Source)
In terms of testing the applications, Flutter is superior. They have widget, UI, functional and unit testing. The documentation on Flutter testing is quite detailed and provides examples of tests with varying levels of complexity. Swift testing on the other hand does not have data-driven, snapshots or grouping tests. However, the XCTest framework that Apple uses for Swift is commended for its UI, performance and integration testing abilities. Finally, in terms of application size, an identical application built on both frameworks seems to double in size on Flutter.
Ultimately, after reading a lot of comparisons and the documentation, I think Swift would be my first choice in terms of a learning curve. The language is designed to be a great language for beginners and the documentation is extensive, but I would have to become far more familiar with the Xcode environment. I know I could rely on the comfort of VSCode to build a native Flutter application, but would have to learn both the framework and the language Dart.