SwiftUI Series - Updating TTBaseUIKit to Support SwiftUI
Table of Contents
Abstract
I realize that now is a suitable time to learn and apply SwiftUI
in the real world. So in this series, I will delve into the fundamental components of SwiftUI. With the knowledge gained, we will update TTBaseUIKit
to support SwiftUI
, allowing us to quickly build applications using these basic components. Additionally, we will develop a new feature called ‘Bus Booking’ using SwiftUI
on the 12Bay application.
Completing this section, we must know the following knowledge:
- Have knowledge about SwiftUI.
- How to build reusable component.
- Have knowledge about SwiftPM.
- Working with data with new concepts such as State, Binding, ObjectBinding, EnvironmentObject…
- Have knowledge about Integrating SwiftUI with UIKit
Introduction to SwiftUI
‘Better apps. Less code.’, is that really true? We will discuss this question when we finish this series.
Things to know about SwiftUI
SwiftUI helps you build great-looking apps across all Apple platforms with the power of Swift — and surprisingly little code. You can bring even better experiences to everyone, on any Apple device, using just one set of tools and APIs. - Apple
If you are an iOS developer, you must learn SwiftUI
quickly from now on. SwiftUI
will soon replace UIKit
, just as Swift
replaced Objective-C
. Don’t be discouraged, keep going, and you will see the results.
'SwiftUI helps you build apps across all Apple platforms with the power of Swift, so SwiftUI is the future.'
Supported Xcode and iOS Version for SwiftUI
SDKs to work with SwiftUI Framework:
- iOS 13.0+
- macOS 10.15+
- UIKit for Mac 13.0+
- tvOS 13.0+
- watchOS 6.0+
In my opinion, With SwiftUI 1.0
have many problems and lacks some essential components. So we should start with SwiftUI 2.0
, it allows us to have a minimum deployment target at iOS 14.0
Imperative vs Declarative
UIKit
uses an imperative syntax, which requires developers to outline a sequence of procedural processes in order to generate the user interfaceSwiftUI
uses a declarative syntax. The developers can declare how the UI should look and function without having to provide a sequence of procedures.
Learn Once, Apply Anywhere
With SwiftUI, Apple offers developers a unified UI framework for building user interfaces on all types of Apple devices.
Practice
We have two series to help you learn SwiftUI. In the first series, we will learn how to create base views and create a package for reusing views. In the second series, we will build a car booking function.
Understanding SwiftUI - Reusable Customisable Views in SwiftUI
Through these series of articles, we will sequentially explore the fundamental components of SwiftUI
, the way we reuse views (Customizing View Modifier and View Builder), compare the differences between the two worlds of UIKit
and SwiftUI
and much more ^^
How to develop a bus booking feature using SwiftUI?
Here is the bus booking prototype
. We will discuss it in detail in future posts.
We have three screens:
- First,
the bus list
shows the main information about the bus, such as the bus operator, departure time, … - Second,
the seat selection
shows the seat layout, and the customer can choose one or more seats. - Third, choose the pickup location and the destination.
Conclusion
Learning something new can often seem difficult, particularly when we have no prior experience with the subject. However, it’s important to persevere and keep trying, as with time and effort, we can overcome the initial challenges and gain a deeper understanding of the topic. - Keep trying!
SwiftUI
is a modern way to declare user interfaces for any Apple platform. Create beautiful, dynamic apps faster than ever before.- Apple
In my next article, I will talk about reusable views
. I will also discuss the main differences between UIKit and SwiftUI. Finally, we will go deeper to understand View
and how to create a BaseView. See you soon!"
Ref
Posts in this Series
- TTBaseUIKit Has Been Integrated With SwiftUI Since Version 2.1.0
- Rebuiding Train Booking Feature by SwiftUI in 12Bay Application - Design
- What Is the Spacer and How Do We Use It in SwiftUI
- 12Bay Integrated SwiftUI. With 12Bay, No StoryBoard, No XIB Files, No Cocoapods, ...
- Understand View in SwiftUI
- Understand Safe Area in SwiftUI
- WWDC23 From the Perspective of an IOS Developer
- SwiftUI Series - Updating TTBaseUIKit to Support SwiftUI