maui
maui copied to clipboard
iOS-Specific enum UIModalPresentationStyle does not support all underlying UIKit options
Description
UIModalPresentationStyle is an iOS Specific enum, which can be used to specify the visual appearance of modal pages.
It can be set on any modal page with On<iOS>().SetModalPresentationStyle(Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific.UIModalPresentationStyle.FormSheet);.
However, it's missing several options which are available in Apple's documentation, most notably:
- Popover
- BlurOverFullScreen
BlurOverFullScreen seems like it'd be a very easy plug and play addition. Popover would be a bit more involved, as it'd require the user to then access the automatically created UIPopoverController as outlined in apple's documentation in order to specify where it's originating from
However as far as I can tell, this would all be achievable without any additional helper methods from maui, so the only thing required to make all of this work are some very minor changes to:
- the enum from Platforms.iOSSpecific: UIModalPresentationStyle
- the extension method which converts it to a native UIKit.UIModalPresentationStyle UIModalPresentationStyle.ToPlatformModalPresentationStyle
Public API Changes
Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific.UIModalPresentationStyle.Popover
Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific.UIModalPresentationStyle.BlurOverFullScreen
Intended Use-Case
I have an application for which a modal would best work as a popover on iOS and macOS, and would help make the application feel more native.
Thanks for the great description of this issue! I don't think this will be a priority for us in the near future. If you're willing to look into it we might be able to review it and get it in that way if it isn't too big of a change.
Thanks for the response @jfversluis ! As expected it was pretty easy to add, so I've submitted a PR which adds support for this.
Merged for .NET 10