0
0
iOS Swiftmobile~10 mins

Navigation path management 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 push a new view controller onto the navigation stack.

iOS Swift
navigationController?.[1](UIViewController(), animated: true)
Drag options to blanks, or click blank then click option'
Apresent
BpopViewController
Cdismiss
DpushViewController
Attempts:
3 left
💡 Hint
Common Mistakes
Using popViewController instead of pushViewController
Using present which is for modal presentation
2fill in blank
medium

Complete the code to pop the current view controller from the navigation stack.

iOS Swift
navigationController?.[1](animated: true)
Drag options to blanks, or click blank then click option'
ApushViewController
BpopViewController
Cpresent
Ddismiss
Attempts:
3 left
💡 Hint
Common Mistakes
Using pushViewController which adds a screen instead of removing
Using dismiss which is for modal views
3fill in blank
hard

Fix the error in the code to set the root view controller of the navigation controller.

iOS Swift
navigationController?.[1] = [UIViewController()]
Drag options to blanks, or click blank then click option'
AvisibleViewController
BtopViewController
CviewControllers
DrootViewController
Attempts:
3 left
💡 Hint
Common Mistakes
Using rootViewController which is not a property of UINavigationController
Using topViewController which is read-only
4fill in blank
hard

Fill both blanks to pop to the root view controller with animation.

iOS Swift
navigationController?.[1](animated: [2])
Drag options to blanks, or click blank then click option'
ApopToRootViewController
BpopViewController
Ctrue
Dfalse
Attempts:
3 left
💡 Hint
Common Mistakes
Using popViewController which only pops one screen
Setting animation to false which disables transition effect
5fill in blank
hard

Fill all three blanks to replace the current navigation stack with two new view controllers.

iOS Swift
navigationController?.[1] = [[2], [3]]
Drag options to blanks, or click blank then click option'
AviewControllers
BFirstViewController()
CSecondViewController()
DrootViewController
Attempts:
3 left
💡 Hint
Common Mistakes
Using rootViewController which is not a UINavigationController property
Passing class names instead of instances