Can anyone tell me what is T.Type
when I use JSONDecoder().decode()
?
I think it is type to decode data what I encoded.
So many example use above method like this:
JSONEncoder().decode([People].self, from: data)
If I check that method's definition I can see T.Type
.
I know the generics but what is T.Type
?
What's the difference between just T
and T.Type
?
when we declare some variables, we allocated their types like this
var someValue: Int
, not var someValue: Int.self
What is the T.Type
exactly and Type.self
?