I'm wondering if there's any way to force the UIViewController
presented by a Share Extension to use the UISheetPresentationController
introduced in iOS 15?
Right now, the only way they're presented is modally, occupying almost the entire screen. Most share extensions don't need that much space and would allow you to have more context from where you shared (the originating app).
Technically share extensions are presented with UISheetPresentationController, just a UISheetPresentationController where detents
only contains the large
detent, so the sheet appears full height on iPhone, and as a form-sized sheet on iPad.
Are you asking if there is a way to customize the detents
on the UISheetPresentationController
instance used to present your extension? If so, unfortunately the answer is no, but as always we welcome feedback on our APIs, and I encourage you to file a feedback report!
Alternatively, you can specify NSExtensionActionWantsFullScreenPresentation
in your extension's Info.plist, which will present your extension over the full screen with no additional chrome (e.g. the shadow, dimming, or corner radius provided by UISheetPresentationController). Then you can size your extension however you want within that full screen view. However, this is not recommended, as this approach loses the standard look and pull to dismiss behavior of UISheetPresentationController.