Focus Management in SwiftUI: Getting Started

Learn how to manage focus in SwiftUI by improving the user experience for a checkout form. By Mina H. Gerges.

5 (3) · 1 Review

Download materials
Save for later
Share
You are currently viewing page 4 of 4 of this article. Click here to view the first page.

Where to Go From Here?

Download the final project using the Download Materials button at the top or bottom of this tutorial.

You’ve learned a lot about managing the focus in SwiftUI apps. This includes how to:

  • Use the FocusState property wrapper with both the focused(_:) and focused(_:equals:) modifiers.
  • Manage focus in lists and with the MVVM design pattern.
  • Use the FocusedValue and FocusedBinding property wrappers to track and change the wrapped values of focused views from other scenes.

To learn more about dealing with text fields and forms, watch Handling Keyboard & Pointer Interactions in SwiftUI. In this course, you’ll learn how to use the iOS keyboard, external hardware keyboards and pointer interactions in a SwiftUI app.

To get more stylish with your forms, check out AttributedString Tutorial for Swift: Getting Started. In this article, you’ll learn how to format text and create custom styles with iOS 15’s new AttributedString value type.

I hope you found this tutorial useful. If you have any comments or questions, feel free to join in the forum discussion below!