0
0
iOS Swiftmobile~10 mins

Why SwiftUI is the modern UI framework in iOS Swift - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a simple SwiftUI text view.

iOS Swift
Text([1])
Drag options to blanks, or click blank then click option'
AText
BHello, SwiftUI!
C"Hello, SwiftUI!"
DView
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes around the string
Using a variable name without declaration
2fill in blank
medium

Complete the code to make the text bold in SwiftUI.

iOS Swift
Text("Welcome").[1]()
Drag options to blanks, or click blank then click option'
Abold
Bitalic
Cunderline
Dfont
Attempts:
3 left
💡 Hint
Common Mistakes
Using italic() instead
Trying to use font() without parameters
3fill in blank
hard

Fix the error in the SwiftUI view declaration.

iOS Swift
struct ContentView: [1] {
  var body: some View {
    Text("Hi")
  }
}
Drag options to blanks, or click blank then click option'
AUIView
BViewController
CController
DView
Attempts:
3 left
💡 Hint
Common Mistakes
Using UIKit classes like UIView or UIViewController
Forgetting to conform to any protocol
4fill in blank
hard

Fill both blanks to create a vertical stack with two text views.

iOS Swift
VStack {
  Text("Hello")[1]
  Text("World")[2]
}
Drag options to blanks, or click blank then click option'
A.padding()
B.bold()
C.italic()
D.underline()
Attempts:
3 left
💡 Hint
Common Mistakes
Using the same modifier for both texts
Forgetting parentheses after modifiers
5fill in blank
hard

Fill all three blanks to create a button that prints a message when tapped.

iOS Swift
Button(action: [1]) {
  Text([2])
}.[3]()
Drag options to blanks, or click blank then click option'
A{ print("Button tapped") }
B"Tap me"
Cpadding
Dbold
Attempts:
3 left
💡 Hint
Common Mistakes
Missing braces in action closure
Not quoting the button label
Forgetting parentheses after modifiers