Migrating from UIKit to SwiftUI
As I learn more about SwiftUI, the more I can see myself migrating most (if not all) of my apps to the new language.
One of the things that we need to know is how. The below conversion table was taken from a very good website called hackwithswift.com by Paul Hudson. I highly recommend this site when ever I can, as it has become my goto for learning both SwiftUI and Swift 5.
The below is only a handful of conversions that we need to know before we even attempt to convert to the new language for any newer apps that we may develop from here on.
Here’s the table:
- UITableView: List
- UICollectionView: No SwiftUI equivalent
- UILabel: Text
- UITextField: TextField
- UITextField with isSecureTextEntry set to true: SecureField
- UITextView: No SwiftUI equivalent
- UISwitch: Toggle
- UISlider: Slider
- UIButton: Button
- UINavigationController: NavigationView
- UIAlertController with style .alert: Alert
- UIAlertController with style .actionSheet: ActionSheet
- UIStackView with horizontal axis: HStack
- UIStackView with vertical axis: VStack
- UIImageView: Image
- UISegmentedControl: SegmentedControl
- UIStepper: Stepper
- UIDatePicker: DatePicker
To see the original document, click below:
About Post Author
(Visited 173 times, 1 visits today)