LeoNatan / LNPopupController

A framework for presenting view controllers as popups of other view controllers, much like the Apple Music and Podcasts apps.
MIT License
3.04k stars 342 forks source link

iOS 17: New “Floating" Popup Bar Style #538

Closed LeoNatan closed 1 year ago

LeoNatan commented 1 year ago

IMG_5512

iDevelopper commented 1 year ago

Hello,

Do you think it's a toolbar? It is really very white and transparent at the same time!

LeoNatan commented 1 year ago

It’s almost done implementing it. The floating background is actually the standard system chrome material, while the tab bar has a thin material.

I’m not sure yet how to implement so the tab bar gets the thin material automatically.

LeoNatan commented 1 year ago

WIP so far:

Simulator Screenshot - iPhone 14 Pro Max - 2023-08-24 at 15 12 47

LeoNatan commented 1 year ago

It's now almost pixel accurate. I think it's good enough for me, considering there are more capabilities in my framework than Apple's implementation (limited to Music).

Simulator Screenshot - iPhone 14 Pro Max - 2023-08-25 at 16 46 36

The only thing left is to decide how to deal with the UITabBar/UIToolbar appearance. By default, if user does no changes to the bottom view's appearance, this is how the floating popup bar will look like:

Simulator Screenshot - iPhone 14 Pro Max - 2023-08-25 at 16 49 15

As you can see, the tab bar's separator is there and the material is the default chrome material. I don't like this. I can probably do the bare minimum of hiding the separator, so it would look like this by default:

Simulator Screenshot - iPhone 14 Pro Max - 2023-08-25 at 16 49 41

Still not optimal, because there is not enough contrast between the tab bar and the floating popup bar, but much better. The issue with automatic effect modification is that the user might have changed the appearance of the bottom bar manually. So maybe I could limit my modification to only if the bottom bar has the default appearance.

LeoNatan commented 1 year ago

Out now in 2.15.0. Enjoy!

iDevelopper commented 1 year ago

Hello,

There is a crash when setting _toolbar.compactAppearance to nil in LNPopupBar.m

Capture d’écran 2023-08-30 à 09 23 09
LeoNatan commented 1 year ago

I’ll investigate, thanks @iDevelopper

LeoNatan commented 1 year ago

@iDevelopper What are you reporting exactly? I don't understand.

Calling self.navigationController.toolbar.compactAppearance = nil; works just fine.

iDevelopper commented 1 year ago

I just ran the example (target LNPopupControllerExample), nothing more. Under iOS 17.0 on device iPhone 14 Pro & simulator, Xcode Version 15.0 beta 8 (15A5229m). The crash occurs following the execution of line 283 _toolbar.compactAppearance = nil; in LNPopupBar.m.

LeoNatan commented 1 year ago

Made changes to the shadow under the floating bar that required a surprising amount of changes to support. 🤣 Will push soon.

IMG_5846 IMG_5845