-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(ios): SplitView UI component #10942
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
View your CI Pipeline Execution ↗ for commit 0bd09f3
☁️ Nx Cloud last updated this comment at |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new SplitView component that wraps iOS's UISplitViewController to provide multi-column layouts (primary/secondary/supplementary/inspector). The implementation includes common base classes, iOS-specific functionality, an Android stub, and supporting changes to the Frame navigation system and ListView to enable sectioned item events.
Key changes:
- New SplitView component with support for up to 4 columns (primary, secondary, supplementary, inspector)
- Frame navigation delegate enhancements to emit
viewControllerShownevents - ListView section index support added to
ItemEventData
Reviewed Changes
Copilot reviewed 18 out of 21 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/core/ui/split-view/split-view-common.ts | Base class defining SplitView types, properties, and common behavior |
| packages/core/ui/split-view/index.ios.ts | iOS implementation using UISplitViewController with column management |
| packages/core/ui/split-view/index.android.ts | Android stub implementation (no native split view support) |
| packages/core/ui/split-view/index.d.ts | TypeScript type definitions |
| packages/core/ui/frame/index.ios.ts | Added navigation controller delegates to emit viewControllerShown events |
| packages/core/ui/list-view/index.ios.ts | Added section field to item events |
| packages/core/ui/list-view/index.d.ts | Updated ItemEventData interface with optional section property |
| packages/core/ui/index.ts | Exported SplitView component |
| apps/toolbox/src/* | Demo app implementation showing SplitView usage |
| package-lock.json | Dependency updates with peer flags added |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Introduces a new
SplitViewcomponent, enabling advanced multi-column layouts (primary, secondary, supplementary, inspector) for applications, with full support for iOS split view layouts.ns-splitview-ios.mov
Overview
SplitViewis a container coordinating up to four column roles backed by nativeUISplitViewControllercolumns:primarysecondarysupplementaryinspectorEach role is provided by a child
Frame(or any controller-backed view). Frames push their own Pages independently while remaining embedded inside the SplitView layout.Instantiation
You can use declarative markup as an example:
Programmatic creation:
Static Members
SplitView.getInstance(): SplitViewBase | null– Returns the last created SplitView instance (singleton convenience), ornullif none.SplitView.SplitStyle(from common) – Determinesdoublevstriplecolumn style. iOS mapping selectsUISplitViewControllerStyle.DoubleColumnorTripleColumn.Properties (from common + iOS behavior)
displayMode: string– Maps toUISplitViewController.preferredDisplayMode.automatic,secondaryOnly,oneBesideSecondary,oneOverSecondary,twoBesideSecondary,twoOverSecondary,twoDisplaceSecondary.splitBehavior: string– iOS 14+ only. Maps topreferredSplitBehavior.automatic,tile,overlay,displace.preferredPrimaryColumnWidthFraction: number– Fractional width (0–1) for primary column.preferredSupplementaryColumnWidthFraction: number– Fraction for supplementary column (applies in triple style).preferredInspectorColumnWidthFraction: number– Fraction for inspector column (SDK / OS version gated; only applied when available).inspectorShowing: boolean(readonly state) – Internal flag tracking visibility of inspector column.Role Assignment
Children declare a role using
splitRole="primary|secondary|supplementary|inspector". If omitted, order of addition is used as fallback.Methods
showPrimary()/hidePrimary()– Show/hide primary column.showSecondary()/hideSecondary()– Show/hide secondary column.showSupplementary()– Shows supplementary column (no explicit hide; hiding handled by displayMode changes).showInspector()/hideInspector()– Toggle inspector column if supported (feature detection viapreferredInspectorColumnWidthFractionproperty presence on native controller).onSecondaryViewCollapsed(secondaryVC, primaryVC)– Hook invoked when system collapses secondary onto primary (e.g., trait/environment changes). Override for custom behavior.onRoleChanged(view, oldRole, newRole)– Internal: invoked when a child view's role property changes; rebinds controllers.Events
inspectorChange– Fired when inspector column visibility changes.{ showing: boolean }underdataproperty on the event args.Version / Platform Considerations
splitBehaviorrequires iOS 14+.Minimal Usage Example
Programmatic Event Hook