0
0
iOS Swiftmobile~10 mins

Build configurations (Debug, Release) in iOS 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 print a message only in Debug mode.

iOS Swift
#if [1]
  print("This is Debug mode")
#endif
Drag options to blanks, or click blank then click option'
APRODUCTION
BTESTING
CRELEASE
DDEBUG
Attempts:
3 left
💡 Hint
Common Mistakes
Using RELEASE instead of DEBUG causes the code to run only in Release builds.
Forgetting the #if directive syntax.
2fill in blank
medium

Complete the code to print a message only in Release mode.

iOS Swift
#if [1]
print("This is Release mode")
#endif
Drag options to blanks, or click blank then click option'
A!DEBUG
BDEBUG
CRELEASE
DPRODUCTION
Attempts:
3 left
💡 Hint
Common Mistakes
Using RELEASE directly is not a default flag in Swift builds.
Forgetting the #if and #endif directives.
3fill in blank
hard

Fix the error in the code to print a debug message only in Debug builds.

iOS Swift
#if [1]
print("Debug build active")
#endif
Drag options to blanks, or click blank then click option'
ADEBUG
BRELEASE
CTEST
DPROD
Attempts:
3 left
💡 Hint
Common Mistakes
Using RELEASE or other undefined flags causes the code not to compile or run as expected.
4fill in blank
hard

Fill both blanks to define a variable only in Debug mode and assign it a value.

iOS Swift
#if [1]
let mode = [2]
#endif
Drag options to blanks, or click blank then click option'
ADEBUG
B"Debug"
C"Release"
DRELEASE
Attempts:
3 left
💡 Hint
Common Mistakes
Assigning the string "Release" inside the Debug block.
Using RELEASE flag instead of DEBUG.
5fill in blank
hard

Fill all three blanks to print different messages for Debug and Release modes.

iOS Swift
#if [1]
print([2])
#else
print([3])
#endif
Drag options to blanks, or click blank then click option'
ADEBUG
B"Debug mode active"
C"Release mode active"
DRELEASE
Attempts:
3 left
💡 Hint
Common Mistakes
Using RELEASE flag which is not predefined.
Mixing up the print messages.