View
public extension View
-
Registers the view as the transition source of the item with the given
id. Apply it to the displayed media rather than its cell, so the transition matches the media’s frame.Declaration
Swift
@MainActor func pagedMediaSource<ID>(id: ID) -> some View where ID : Hashable -
pagedMediaViewer(selection:items: recenter: presentationViewInsets: configure: onIndexChange: transitionImage: onWillDismiss: onDidDismiss: mediaItem: ) Presents a
PagedMediaViewControllerwheneverselectionpoints to one of theitems.Declaration
Swift
@MainActor func pagedMediaViewer<Item: Identifiable>( selection: Binding<Item.ID?>, items: [Item], recenter: Binding<Item.ID?>? = nil, presentationViewInsets: UIEdgeInsets = .zero, configure: ((PagedMediaViewController) -> Void)? = nil, onIndexChange: ((Int) -> Void)? = nil, transitionImage: ((Item) -> UIImage?)? = nil, onWillDismiss: ((Item, PagedMediaItem) -> Void)? = nil, onDidDismiss: ((Item) -> Void)? = nil, mediaItem: @escaping (Item) -> PagedMediaItem ) -> some ViewParameters
selectionItem to present. Set back to
nilonce the viewer dismisses.itemsItems to page through, in the order they are displayed.
recenterOptional
scrollPosition(id:)binding, updated while paging so sources in a lazy container stay laid out for the dismissal.presentationViewInsetsInsets on the viewer’s presentation frame. Defaults to
.zero.configureCustomization of the viewer, e.g. its header and footer containers.
onIndexChangeCalled after the transition to a new item is completed.
transitionImageOptional image for the item’s transition. Defaults to a snapshot of the source, which is blank for video layers.
onWillDismissCalled just before the dismissal transition ends. Perfect time to sync the source with the media item.
onDidDismissCalled after the dismissal transition ends.
mediaItemProvides the media item view for the given item.
View on GitHub
Install in Dash