Post

Replies

Boosts

Views

Activity

Can I add a generic ViewModifier to the Library?
I have a ViewModifier that I use by extending View as such: extension View {     func asCard() -> some View {         self.modifier(CardViewModifier())     } } I tried adding it to the Library as such:     @LibraryContentBuilder     func modifiers(base: View) -> [LibraryItem] {         LibraryItem(base.asCard)     } But that produces the following error message: Protocol 'View' can only be used as a generic constraint because it has Self or associated type requirements I also tried using Any but that didn't work either.
1
0
1.2k
Jun ’20