SwiftUi basic questions

Hi, just some general questions on SwiftUI:


1 . What is exactly swiftUi?

2. How is swiftUI different from storyboards and from AppKit, UiKit etc…?

3. Does SwiftUI allow you to drag and drop Objects like story boards?

3. How does it relate/corrolate with storyboards?


Also, how easy does it seems to migrate a current existing app to swiftui?


Thanks.

I think it would make more sense to wait until after WWDC is finished and you’ve watched all the relevant session videos. Many of those questions will be answered.

Go through the Tutorials and you will get all the answer you need. https://developer.apple.com/tutorials/swiftui/tutorials

UIKit UIs are made using the drag-and-drop Interface Builder. UIKit apps connect to the code using outlets and actions.

SwiftUI UIs are made programmatically. SwiftUI code is controlled from the same code as the UI. SwiftUI is only in iOS 13.0 and later!
As for your questions:
  1. SwiftUI is a UI framework that uses a declarative syntax where you basically tell the framework what you want and the framework figures out how to do it. (AppKit/UIKit/WatchKit use an imperative syntax where you tell the framework what to do)

  2. SwiftUI user interfaces can be made using code or using Xcode Previews (you can switch as frequently as you like during the development process, whereas with AppKit/UIKit/WatchKit you have to use Interface Builder (.storyboard files) or code for the entirety of the development process.)

  3. SwiftUI does not use storyboards, and I believe it does support Drag and Drop interfaces, but I am not sure about this one.

  4. SwiftUI can be integrated with AppKit/UIKit/WatchKit: In order to integrate SwiftUI into one of the other three frameworks, you use a hosting controller and can put a SwiftUI view in it. It seems to be a storyboard reference but for SwiftUI views. For integrating AppKit/UIKit/WatchKit into SwiftUI there are representable protocols (Example: UIViewRepresentable, UIViewControllerRepresentable) where you can make and update your AppKit/UIKit/WatchKit views for SwiftUI.


Go through the Tutorials and you will get all the answer you need.

I found the tutorials very helpful when learning SwiftUI. There is a section where you integrate with UIKit in order to put a map into the example app.


SwiftUi basic questions
 
 
Q