What are best practices for using a navigation controller

Generated on 8/3/2024

1 search

To effectively use a navigation controller, here are some best practices based on the content from WWDC sessions:

  1. Handle Transitions Gracefully:

    • Be prepared for a new transition to start at any time. Don't try to handle being in a transition differently from not being in a transition. For example, always call push regardless of whether a transition is running or not (Enhance your UI animations and transitions).
    • Keep temporary transition state to a minimum. The less state you have, the less likely you are to make other code dependent on transition state, and it's one less thing to clean up. If you do need to keep track of state during a transition, reset it by viewDidAppear or viewDidDisappear (Enhance your UI animations and transitions).
  2. Consistency Across Devices:

    • Ensure that navigation elements like tabs are consistent between iPhone and iPad to allow users to navigate easily no matter what device they're using. Avoid adding too many tabs as it can make it harder for users to locate information within your app (Elevate your tab and sidebar experience in iPadOS).
  3. Use Delegate Methods:

  4. Adopt New APIs for Enhanced Interactions:

    • Leverage new APIs that simplify building important interactions like customization menus and drag and drop, which can help you accomplish more with less code (Platforms State of the Union).
  5. Customization and Personalization:

By following these best practices, you can create a more efficient and user-friendly navigation experience in your app.

Enhance your UI animations and transitions

Enhance your UI animations and transitions

Explore how to adopt the zoom transition in navigation and presentations to increase the sense of continuity in your app, and learn how to animate UIKit views with SwiftUI animations to make it easier to build animations that feel continuous.

Explore multiview video playback in visionOS

Explore multiview video playback in visionOS

Learn how AVExperienceController can enable playback of multiple videos on Apple Vision Pro. Review best practices for adoption and explore great use cases, like viewing a sports broadcast from different angles or watching multiple games simultaneously. And discover how to design a compelling and intuitive multiview experience in your app.

Evolve your document launch experience

Evolve your document launch experience

Make your document-based app stand out, and bring its unique identity into focus with the new document launch experience. Learn how to leverage the new API to customize the first screen people see when they launch your app. Utilize the new system-provided design, and amend it with custom actions, delightful decorative views, and impressive animations.

Platforms State of the Union

Platforms State of the Union

Discover the newest advancements on Apple platforms.

Elevate your tab and sidebar experience in iPadOS

Elevate your tab and sidebar experience in iPadOS

iPadOS 18 introduces a new navigation system that gives people the flexibility to choose between using a tab bar or sidebar. The newly redesigned tab bar provides more space for content and other functionality. Learn how to use SwiftUI and UIKit to enable customization features – like adding, removing and reordering tabs – to enable a more personal touch in your app.