shaps80 / SwiftUIBackports

A collection of SwiftUI backports for iOS, macOS, tvOS and watchOS
MIT License
931 stars 59 forks source link

Fix `presentationDetents` order #21

Closed schiewe closed 1 year ago

schiewe commented 1 year ago

Have you read the Contributing Guidelines?

Yes! 🎉

Issue #

Describe your changes

UISheetPresentationController.detents are expected to be ordered:

When you set this value, specify detents in order from smallest to largest height.

Otherwise, sheets are opened with a random dentent if you provide more than one in SwiftUI, e.g.:

.backport.presentationDetents([.medium, .large])

because detents are forwarded as an unordered Set to the underlying UISheetPresentationController.detents array for the backport:

func presentationDetents(_ detents: Set<Backport<Any>.PresentationDetent>) -> some View
shaps80 commented 1 year ago

Thank you for this, I thought I'd fixed this already, oops 🙈

shaps80 commented 1 year ago

This is now in release v1.7.0 👍 – thanks for the contribution ;)