Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

what is the entry point of a swiftui app? o a. viewcontroller b. appdel…

Question

what is the entry point of a swiftui app?
o a. viewcontroller
b. appdelegate
c. @main struct myapp
d. scenedelegate
clear my choice
what is the main advantage of swiftui?
o a. more code
b. less readability
c. automatic ui updates
d. manual layout handling
clear my choice
what is the purpose of @binding in swiftui?
a. creating animations
b. sharing state with child views
c. managing app scenes
d. declaring constants
clear my choice

Explanation:

Brief Explanations
  • For the first question: In SwiftUI, the entry point is defined using the @main attribute on a struct conforming to the App protocol (e.g., @main struct MyApp). ViewController is more related to UIKit, AppDelegate and SceneDelegate were used in older iOS app architectures before SwiftUI's simplified entry.
  • For the second question: SwiftUI's key advantage is its ability to automatically update the UI when the underlying data (state) changes. "More code" and "Less readability" are not advantages. "Manual layout handling" is something SwiftUI abstracts away compared to more manual UI - building approaches.
  • For the third question: @Binding in SwiftUI is used to share mutable state between a parent view and its child views. It's not for creating animations (that might involve @State with animation modifiers in some cases), managing app scenes (handled at a higher - level app structure), or declaring constants (@State or regular constants are for that).

Answer:

  1. c. @main struct MyApp
  2. c. Automatic UI updates
  3. b. Sharing state with child views