Vorrei creare un protocollo con un metodo che accetta un input generico e restituisce un valore generico.
Questo è quello che ho provato finora, ma produce l'errore di sintassi.
Uso dell'identificatore non dichiarato T.
Che cosa sto facendo di sbagliato?
protocol ApiMapperProtocol {
func MapFromSource(T) -> U
}
class UserMapper: NSObject, ApiMapperProtocol {
func MapFromSource(data: NSDictionary) -> UserModel {
var user = UserModel() as UserModel
var accountsData:NSArray = data["Accounts"] as NSArray
return user
}
}