PagedMediaSource

@MainActor
public struct PagedMediaSource

Original position of a media item, used by the presentation and dismissal transitions.

  • Frame of the item in window coordinates.

    Declaration

    Swift

    @MainActor
    public let frameInWindow: CGRect
  • Corner radius the item is displayed with. The transition rounds the media to it at the source end. Defaults to 0.

    Declaration

    Swift

    @MainActor
    public let cornerRadius: CGFloat
  • Corners cornerRadius applies to. Defaults to all corners.

    Declaration

    Swift

    @MainActor
    public let maskedCorners: CACornerMask
  • How the item fills its frame. .scaleAspectFill keeps a cropped thumbnail cropped at the source end of the transition. Defaults to .scaleAspectFit.

    Declaration

    Swift

    @MainActor
    public let contentMode: UIView.ContentMode
  • Hides the item while the transition animates it and reveals it once done.

    Declaration

    Swift

    @MainActor
    public let setHidden: (Bool) -> Void
  • Initializes the source with the item’s frame in window coordinates, its shape and an optional visibility handler.

    Declaration

    Swift

    @MainActor
    public init(frameInWindow: CGRect,
                cornerRadius: CGFloat = 0,
                maskedCorners: CACornerMask = [.layerMinXMinYCorner, .layerMaxXMinYCorner, .layerMinXMaxYCorner, .layerMaxXMaxYCorner],
                contentMode: UIView.ContentMode = .scaleAspectFit,
                setHidden: @escaping (Bool) -> Void = { _ in })
  • Initializes the source from a view, using its frame in window coordinates, its layer’s corners and content mode, and toggling its alpha.

    Declaration

    Swift

    @MainActor
    public init(view: UIView)