Post

Replies

Boosts

Views

Created

Multi type modifiers
How can I write multi type of modifiers? I used this code and got error struct LibraryContent: LibraryContentProvider {   func modifiers(base: Image) -> [LibraryItem] {     LibraryItem(       base.resizedToFill(width: 100.0, height: 100.0),       title: "Image Resize To Fill",       category: .layout     )     LibraryItem(       base.normalText(font: .title2, weight: .bold),       title: "Text Normal",       category: .layout     )   } } extension Image {   func resizedToFill(width: CGFloat, height: CGFloat) -> some View {     self       .resizable()       .aspectRatio(contentMode: .fill)       .frame(width: width, height: height)   } } extension Text {   func normalText(font: Font, weight: Font.Weight) -> some View {     self       .font(font)       .fontWeight(weight)   } }
2
0
870
May ’22