SwiftUI is coming, itโ€™s time to say goodbye to UIKit ๐Ÿ‘‹๐Ÿผ

My first impression using this new technology

Reza Ilham
Swift2Go
Published in
4 min readJun 10, 2019

--

Great news for Apple Developers! Recently Apple announced SwiftUI at #WWDC19, San Jose, CA. The first time I heard this, I was like, โ€œwhat is this? is this a new language or something? so we need to learn a new language again?โ€

This is a big โ€œnewโ€ that triggered my curiosity, especially after I saw @johnsundellโ€™s tweet about it. Some parts that are previously complicated to code with SwiftUI are now much easier with only a few lines of code writing.

What is SwiftUI?

Better apps. Less code.

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 SwiftUI, you can define what your appโ€™s UI should do with concise, declarative language, and say goodbye to tons of confusing UIKit code ๐Ÿ‘‹๐Ÿผ. 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.

Try SwiftUI for the first time

The first thing to know is that SwiftUI only supports iOS 13 and iOS 13 is just in Xcode 11 and Xcode 11 it's not released yet so we have to install Xcode 11 Beta for now. And oh! Xcode 11 requires a Mac running macOS 10.14.3 or later but if you want to try SwiftUI with tools development is only available when running on macOS 10.15. Itโ€™s not released yet also so we have to install macOS Beta too.๐Ÿ˜ช

My First Look

When I saw the code, I have no idea! There is no resemblance to what we usually use, such as UIKit moreover UIStoryboards and his friends. But, on the other side, this SwiftUI is pretty easy to learn, the code is clean and simple.

Iโ€™m trying to create a movie app using SwiftUI and this is the result:

What I found after trying SwiftUI

Thereโ€™s no AutoLayout. instead, you use things like H/VStack, Groups, etc. SwiftUI replaces storyboards with code, thus it will be very easy to create a reusable view and this is very good because we often get conflict code problems when using storyboards in the project team, with SwiftUI will avoid that problem. ๐Ÿ‘๐Ÿป

Dark mode. changes the typical bright theme to a darker one, which can be easier on the eyes, particularly at night. Some people just think it looks better, and I agree. Developers will be able to add dark mode to their apps. I did nothing but my apps support dark mode, itโ€™s really cool. ๐Ÿ˜Ž

Live Preview. in Xcode 11 when you use SwiftUI you can real-time review the results of the code you wrote without having to build. This saves a lot of time, but will this feature make the processor work harder? I think yes, because I experienced some lag when using it, or maybe because itโ€™s still just a beta version. ๐Ÿค”

Mix SwiftUI and UIKit, donโ€™t worry you no need really to say goodbye to UIKit you can mix that two using UIHostingController. ๐Ÿ˜‰

Conclusion

SwiftUI only works on iOS 13, macOS 10.15, etc. I think SwiftUI will really be used in the next 2 years waiting for users to install the latest iOS unless you really want to make apps that only support iOS13 and above.

There are still many other new things from SwiftUI that must be learned, like me who still don't know how to eliminate the separator line in the List ๐Ÿ˜…. I think we still have a lot of time until the time comes when our project really needs to use this new technology.

Thanks for reading! ๐Ÿ™๐Ÿผ if you found this is helpful please give clap ๐Ÿ‘๐Ÿผor you got something to add? just write a comment below. Visit my Linkedin profile and also my Instagram connect with me!

Lastly, if you want to check how I made the movie app using SwiftUI you can clone the completed project in the repository below. ๐Ÿ‘‡๐Ÿผ

--

--