Error: Cannot convert value of type 'QuoteData?' to expected argument type 'T.Type'

hello. I can't figure out why I get this error, or how to fix it. Thanks.
este es el código completo
import SwiftUI

struct ContentView: View {

@State private var QuoteData:QuoteData?


var body: some View {
    
    HStack{
        
        Spacer()
        
        VStack(alignment: .trailing) {
            Spacer()
            
            Text(QuoteData?.en ?? "")
                .font(.title2)
            Text("- \(QuoteData?.author ?? "")")
                .font(.title2)
                .padding(.top)
            
                Spacer()
            
            Button(action: loadData){
                
                Image(systemName: "arrow.clockwise")
                
            }
            
            .font(.title)
            .padding(.top)
            
            
            
        }
    }
    .multilineTextAlignment(.trailing)
    .padding()
    .onAppear(perform:  loadData)
    
    
}
private func loadData(){
    
    guard let url = URL(string: "https://programming-quotes-api.herokuapp.com/quotes/random") else {
        return
    }
    URLSession.shared.dataTask(with: url){ data, response, error in
        guard let data = data else{ return }

        if let decodeData = try? JSONDecoder().decode(QuoteData.self, from: data){
            Cannot convert value of type 'QuoteData?' to expected argument type 'T.Type'
            Generic parameter 'T' could not be inferred




            DispatchQueue.main.async{
                self.QuoteData = decodeData
            }
        }
            
        
    }.resume()
    
    
}

}

struct QuoteData: Decodable {

var _id: String
var en: String
var author: String
var id: String

}

struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}

The problem is right here. You’ve declared a variable named QuoteData, so now you have a type and a variable that both have the same name. Later when you use QuoteData.self, it thinks you’re talking about the variable, not the type.

I’d recommend changing the name of the variable to lowercase, like this:

@State private var quoteData: QuoteData?
2 Likes