0
0
iOS Swiftmobile~10 mins

Programmatic navigation 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](DetailViewController(), animated: true)
Drag options to blanks, or click blank then click option'
Apresent
BpushViewController
CpopViewController
Ddismiss
Attempts:
3 left
💡 Hint
Common Mistakes
Using popViewController instead of pushViewController
Using present instead of pushViewController
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
Bpresent
CpopViewController
Ddismiss
Attempts:
3 left
💡 Hint
Common Mistakes
Using pushViewController instead of popViewController
Using dismiss instead of popViewController
3fill in blank
hard

Fix the error in the code to present a view controller modally.

iOS Swift
present([1], animated: true, completion: nil)
Drag options to blanks, or click blank then click option'
ADetailViewController()
Bself
CnavigationController
Dself.navigationController
Attempts:
3 left
💡 Hint
Common Mistakes
Passing self instead of the new view controller
Passing navigationController instead of the new view controller
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
Btrue
Cfalse
DpopViewController
Attempts:
3 left
💡 Hint
Common Mistakes
Using popViewController instead of popToRootViewController
Setting animated to false when animation is desired
5fill in blank
hard

Fill all three blanks to replace the current view controller stack with a new one.

iOS Swift
navigationController?.[1]([[2]], animated: [3])
Drag options to blanks, or click blank then click option'
AsetViewControllers
BDetailViewController()
Ctrue
Dfalse
Attempts:
3 left
💡 Hint
Common Mistakes
Using pushViewController instead of setViewControllers
Passing a single view controller instead of an array
Setting animated to false when animation is desired