CalendarView icon indicating copy to clipboard operation
CalendarView copied to clipboard

ANyView?

Open kylebrowning opened this issue 1 year ago • 4 comments

Why is erasing to any view required? when I remove those erasures, the UI is no longer styled

kylebrowning avatar Jun 25 '24 20:06 kylebrowning

Hey @kylebrowning,

I'll start by answering the second question - the reason is that the protocols expect the function to return AnyView, so if you put any View in there, the protocol will simply use the default implementation of the function as there is a mismatch of types.

And now moving on to a more difficult question for me - it's embarrassing to admit, but I don't remember why I did that - I probably didn't want to put too many typealias in there, but I'm not sure 😅

I'm planning to come back to this library in about 1.5 months (I'm currently working on NavigationView, then there will be PopupView and then I'm releasing MediaPicker), so I promise to come back to this question then 😅

Thanks for your question and have a nice day!

FulcrumOne avatar Jun 25 '24 22:06 FulcrumOne

Yeah unfortunately using AnyView breaks identity and is discouraged by Apple in most cases. :/.

kylebrowning avatar Jun 25 '24 22:06 kylebrowning

yeah, I know this breaks the view hierarchy on re-rendering and if that's the only reason I did it (not sure tho), then it's an obvious mistake. Anyways, I promise to come back here ASAP 😉

FulcrumOne avatar Jun 26 '24 08:06 FulcrumOne

Thanks for the quick response. LMK if you need help.

kylebrowning avatar Jul 05 '24 14:07 kylebrowning