Swift

Expose the Root View for Full-Screen Capture

To capture the entire app screen, you need access to the root UIView. Add an extension:

UIApplication+rootViewController.swift

Then use:

Alternative path: Capture a specific region with UIViewRepresentable

In following steps we will show you to how to wire the rootView into the ScreenCapturer. However in case you prefer to capture a specific region of the screen - you can capture a specific UIView backed by SwiftUI. Create a UIViewRepresentable that produces the view you want to share, embed it in your layout, and pass its underlying UIView to the capturer (e.g. via a callback when makeUIView runs).

Example - a sharable time label:

Display TimeLabelView in SwiftUI and wire its UIView into your manager (e.g. via @State and an onAppear / Coordinator), then pass that view to ScreenCapturer(withView:) to share only that region instead of the full screen.