shaps80 / SwiftUIBackports

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

PresentationDetents #52

Closed Alex293 closed 1 year ago

Alex293 commented 1 year ago

Hi, is it possible to backport more presentationDetents like .fraction and .height ?

Alex293 commented 1 year ago

I managed to do it using private apis would this be acceptable ? If so I’ll clean my fork and open a pr

shaps80 commented 1 year ago

No private APIs I'm afraid. The point of the backports is that they are identical to existing API and are shippable in all apps.

The additional detent APIs where introduced from iOS 15+ at which point you can use the official APIs, so it made no sense to backport them.

Thanks.

Alex293 commented 1 year ago

Make sens that's why I called it out in the PR. Too bad I can't use .height though.

shaps80 commented 1 year ago

Are you suggesting you could implement the height API without private API usage? I'd consider that but from your PR I don't see that being the case.

Alex293 commented 1 year ago

.height is implementable on iOS 16 without private api in the pr I was using both options private on ios 15 and public above ios 16

shaps80 commented 1 year ago

.height is implementable on iOS 16 without private api in the pr I was using both options private on ios 15 and public above ios 16

Sure, but then it's not a backport. It's just using the official support. Height and fraction came in iOS 16, so there's nothing to 'backport' or am I missing something?

Alex293 commented 1 year ago

height and fraction are available in UIKit since iOS 16 and 16.4 in swiftui

shaps80 commented 1 year ago

That's right. So there's no point in "back porting" something that's officially available if you're already targeting iOS 16+

Also, keep in mind this depends on features being available in UIKit in order to backport, which again was only made available since iOS 16+

Backporting these would require CUSTOM UIPresentationControllers and re-implementing the entire stack, I don't see the value for a feature that's almost never requested I'm afraid.

Alex293 commented 1 year ago

I thought exposing iOS 16.4 apis to 16.0 had value. Thanks you anyway for having looked at it.

shaps80 commented 1 year ago

I thought exposing iOS 16.4 apis to 16.0 had value. Thanks you anyway for having looked at it.

Ah I see, I thought you had said the backports would require private api even for the iOS 16.4 apis.

Absolutely agree if we can safely and publicly backport 16.4 to 16.0 thatd be great and I'd accept that 👍

Sorry for the confusion

Alex293 commented 1 year ago

Ok, I'll make a proper PR for iOS 16 then. I wasn't sure I there was a misunderstanding or if you were politely telling me you weren't interested. Sorry for the confusion too, that's probably on me since I'm not a native speaker.

shaps80 commented 1 year ago

No no, no need to apologise. I'd never dismiss or necessarily be "uninteresting" in an idea. I just like to understand it fully before committing to something.

Look forward to it 👍