What is the type of a constant that is being implemented into a custom modifier?

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:
Code Block
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.
Code Block
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]))
    }
}

Code Block
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
Code Block
icon
is. I just can't seem to figure it out.

Thanks!

Grey360
In Swift, type names should start with Capital letter.
If you have some reason that you cannot follow the basic coding rule of Swift, please re-interpret the following description.


You declare icon in your SettingsIconImageStyleUsingSFSymbols as a concrete struct type RowAndIconView.
Then there is no choice other than you declare it as RowAndIconView:
Code Block
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 icons: [RowAndIconView]) -> some View {
self.modifier(SettingsIconImageStyleUsingSFSymbols(icon: icons[0]))
}
}
//Or
extension View {
func settingsIconViewWithSFSymbols(with icon: RowAndIconView) -> some View {
self.modifier(SettingsIconImageStyleUsingSFSymbols(icon: icon))
}
}


What is the type of a constant that is being implemented into a custom modifier?
 
 
Q