From the very beginning, Apple is known as the game-changer in whatever field they jump into and there’s no big difference when it comes to mobile app development or developing for all the available platforms in the world.
The cross-platform technologies or frameworks available currently are providing support to two of the most popular mobile platforms i.e., Android & iOS and gradually they are starting their support to web and desktop platforms.
But Apple as always comes with a much bigger surprise for all of us and mainly for their competitors like Flutter & React Native by announcing SwiftUI in their global conference WWDC 2019.
We know Swift language for developing iOS related apps, but what is SwiftUI ?
In Apple’s Own Words-
“SwiftUI” is an innovative, exceptionally simple way to build user interfaces across all Apple platforms with the power of Swift. Build user interfaces for any Apple device using just one set of tools and APIs.
With a declarative Swift syntax that’s easy to read and natural to write, SwiftUI works seamlessly with new XCode design tools to keep your code and design perfectly in sync.
Automatic support for Dynamic Type, Dark Mode, localization, and accessibility means your first line of SwiftUI code is already the most powerful UI code you’ve ever written.”
But the question arises in all of our minds that why Apple introduced SwiftUI when tools like Storyboard are already available.
If you are an iOS developer and developing iOS Apps for some time then you know how cumbersome and tedious it is to design in storyboard, that’s when Apple introduced SwiftUI.
Making the process of designing screens much more easier, so that developer can instantly see the output in the Canvas alongside the Code Editor.
The declarative way of coding style would make the code easier to read and understand while user will get better experience of the app.
#SwiftUI - Advantages and Disadvantages:
1) Support for All: SwiftUI is supporting all the platforms of Apple like iOS, iPadOS, macOS, watchOS and tvOS. But by using SwiftUI, in near future, you may develop Multi-platform applications which are not just targeting Apple platforms but popular platforms like Android, Windows, Ubuntu, CentOS, Amazon Linux, Web, and, many more.
2) Fast Reload: As the cross-platforms technologies are booming and supporting features like Fast or Hot Reload in their basic setup, Apple is also keeping up to the task of providing feature like Fast Reload as soon as you create a code which will reflect on the canvas.
3) SwiftUI with Combine: According to the Apple documentation. The Combine framework provides a declarative Swift API for processing values over time.
These values can represent many kinds of asynchronous events. Combine declares publishers to expose values that can change over time, and subscribers to receive those values from the publishers.
4) Drawback: SwiftUI is not providing Android support currently but later in the year it might announce support for Android Platform too, but if you are in the hurry or in any emergency for targeting Android users using your swift code then you can prefer third-party cross-platform tool like SCADE.
But it comes with “Paid Subscription” if you want to make any customization or any supporting system for users.
5) Future: SwiftUI is truly a cross-platform gangster as Swift is approaching more and more platforms as you can see it recently gave support to Windows so you can continue development having Windows in mind.
SwiftUI will benefit you to create cross platform applications as you can check this link for further information.
Apple is also extending SwiftUI to many levels as you can also buy toys or robots (which are programmable using Swift) from Apple's official website.
You can choose SwiftUI to develop Multi-platform applications and also you can target Cross-platform in future as Swift is currently approaching for Android so we can hope for it in future or in this year WWDC.