shaffex

NavigationView is a container view that provides a navigation interface for hierarchical content. It’s used to manage a stack of views, allowing users to navigate to deeper levels of content and return.

Note: NavigationView is deprecated in iOS 16 and later. For new apps, or apps targeting newer OS versions, it is recommended to use NavigationStack.

Parameters:

Example:

The example below shows a NavigationView containing a List. The navigationTitle is set to “Navigation View”. A NavigationLink within the list allows the user to navigate to a detail view.

<body>
    <navigationview>
        <list navigationTitle="Navigation View">
            <navigationlink destination="viewDetails">
                <text>Go to Details</text>
            </navigationlink>
        </list>
    </navigationview>
    <text id="viewDetails">Details</text>
</body>

Screenshot

Inline Title Example:

This example demonstrates the use of navigationTitleDisplayMode="inline" to force the navigation title to always be displayed in the smaller, inline format.

<body>
    <navigationview>
        <list navigationTitle="Navigation View" navigationTitleDisplayMode="inline">
            <navigationlink destination="viewDetails">
                <text>Go to Details</text>
            </navigationlink>
        </list>
    </navigationview>
    <text id="viewDetails">Details</text>
</body>

Screenshot