iOS

SwiftUI Navigation

NavigationView, NavigationStack, sheets, alerts, toolbars, programmatic navigation

18 câu hỏi phỏng vấn·
Mid-Level
1

What is the main difference between NavigationStack and NavigationView in SwiftUI?

Câu trả lời

NavigationStack (iOS 16+) replaces NavigationView and provides explicit state management with NavigationPath. NavigationView uses an implicit navigation stack, while NavigationStack enables full programmatic control of navigation through bindable state.

2

What is the purpose of the navigationTitle modifier in SwiftUI?

Câu trả lời

The navigationTitle modifier sets the title displayed in the navigation bar when a view appears. It accepts a displayMode parameter to control the title's display style (inline, large). It is a key navigation interface element.

3

What is the correct method to create navigation to a destination with NavigationLink?

Câu trả lời

NavigationLink accepts a label (displayed view) and a destination (target view). In modern SwiftUI, prefer the initializer with value and navigationDestination modifier for better state management. NavigationLink shows a chevron indicator by default on iOS.

4

What is the role of the toolbar modifier in SwiftUI?

5

What is the correct syntax for creating a NavigationStack with state?

+15 câu hỏi phỏng vấn

Nắm vững iOS cho lần phỏng vấn tiếp theo

Truy cập tất cả câu hỏi, flashcards, bài kiểm tra kỹ thuật, bài tập code review và mô phỏng phỏng vấn.

Bắt đầu miễn phí