Hi there,
I'm developing an app that uses custom view modifiers using struct View: ViewModifier {} and extension {} but am having issues when it comes to using the below extension:
extension View {
func settingsIconViewWithSFSymbols(with icon: <#unknownType#>) -> some View {
self.modifier(settingsIconImageStyleUsingSFSymbols(icon: icons[0]))
}
}
In that code block just after the with icon text, I'm unsure what type it is. Here's the full block of code, so you can have a look at what I mean.
import SwiftUI
struct settingsIconImageStyleUsingSFSymbols: ViewModifier {
let icon: rowAndIconView
func body(content: Content) -> some View {
Image(icon.systemImageName)
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 35, height: 35)
.padding(7)
.foregroundColor(icon.foregroundColorOfImage)
.background(icon.backgroundColorOfImage)
.cornerRadius(10)
.padding(5)
}
}
extension View {
func settingsIconViewWithSFSymbols(with icon: <#Unknown Type#>) -> some View {
self.modifier(settingsIconImageStyleUsingSFSymbols(icon: icons[0]))
}
}
struct rowAndIconView: Identifiable {
let id = UUID()
let systemImageName: String
let text: String
let foregroundColorOfImage: Color
let backgroundColorOfImage: Color
}
I'd really appreciate it if someone could please tell me what type the constant icon
is. I just can't seem to figure it out.
Thanks!
Grey360
Selecting any option will automatically load the page