Home > Net >  Reference to generic type 'SomeResponse' requires arguments in <...>
Reference to generic type 'SomeResponse' requires arguments in <...>

Time:03-05

I have getting the error "Reference to generic type 'SomeResponse' requires arguments in <...>"

struct SomeResponse<T: Decodable>: Decodable {

     let success: Bool

     let body: T?
}

final class SomeService {

    var response: SomeResponse? ///Reference to generic type 'SomeResponse' requires arguments in <...>

}

I don't fully understand the syntax of what I should write into the property "response"

CodePudding user response:

Your class should also be generic.

final class SomeService<T: Decodable> {
    var response: SomeResponse<T>?
}
  • Related