0
0
Swiftprogramming~10 mins

BuildBlock for combining results in Swift - Interactive Code Practice

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

Complete the code to define a BuildBlock that combines two results.

Swift
let combined = BuildBlock([1]("Hello"), Text("World"))
Drag options to blanks, or click blank then click option'
AView
BString
CInt
DText
Attempts:
3 left
💡 Hint
Common Mistakes
Using String instead of Text causes a type error.
Using Int or View directly is incorrect here.
2fill in blank
medium

Complete the code to combine three Text views using BuildBlock.

Swift
let combined = BuildBlock(Text("One"), Text("Two"), [1]("Three"))
Drag options to blanks, or click blank then click option'
AString
BInt
CText
DView
Attempts:
3 left
💡 Hint
Common Mistakes
Using String instead of Text causes errors.
Using Int or View directly is not valid here.
3fill in blank
hard

Fix the error in the BuildBlock by completing the code.

Swift
let combined = BuildBlock(Text("Swift"), [1]("UI"))
Drag options to blanks, or click blank then click option'
AInt
BText
CView
DString
Attempts:
3 left
💡 Hint
Common Mistakes
Using String instead of Text causes a type mismatch.
Using Int or View directly is invalid.
4fill in blank
hard

Fill both blanks to create a BuildBlock combining two Text views with modifiers.

Swift
let combined = BuildBlock([1]("Hello").font(.title), [2]("World").foregroundColor(.blue))
Drag options to blanks, or click blank then click option'
AText
BString
CView
DLabel
Attempts:
3 left
💡 Hint
Common Mistakes
Using String or View instead of Text causes errors.
Label is not appropriate here.
5fill in blank
hard

Fill all three blanks to create a BuildBlock combining Text views with different modifiers.

Swift
let combined = BuildBlock([1]("Swift").bold(), [2]("UI").italic(), [3]("Kit"))
Drag options to blanks, or click blank then click option'
AText
BString
CView
DLabel
Attempts:
3 left
💡 Hint
Common Mistakes
Using String or View instead of Text causes errors.
Label is not suitable here.