iPhone Duo SwiftUI examples

Explore SwiftUI APIs, components, and modifiers on iPhone Duo. Compare portrait and landscape layouts in closed, partially open, and fully open states, with Swift code and Apple documentation.

Toolbars

Axis Behavior

The bar axis behavior of the toolbar item.

Explore Axis Behavior on iPhone Duo in portrait and landscape across closed, partially open, and fully open states, with SwiftUI code and Apple API documentation.

 NavigationStack {
            Text("FooBar")
                .toolbar {
                    ToolbarItem {
                        Button(role: .confirm, action: action)
                    }
                    ToolbarItem {
                        Button(role: .cancel, action: action)
                    }
                    .axisBehavior(.horizontalOnly)
                    ToolbarItem {
                        Button("Foo", action: action)
                    }
                    ToolbarItem {
                        Button("Bar", action: action)
                    }
                    .axisBehavior(.verticalPreferred)
                }
}
iOS 27.1+ iPadOS 27.1+

Every available iPhone Duo screenshot for Axis Behavior.

6 views