Ich versuche, einen Verweis auf eine Funktion zu erhalten, wie so:Swift - Verweis auf eine Funktion mit dem gleichen Namen erhalten, aber verschiedenen Parametern
class Toto {
func toto() { println("f1") }
func toto(aString: String) { println("f2") }
}
var aToto: Toto = Toto()
var f1 = aToto.dynamicType.toto
ich folgende Fehlermeldung habe: Ambiguous use of toto
Wie Ich bekomme Funktion mit bestimmten Parametern?
Beachten Sie, dass 'aToto.dynamicType.toto' eine curried Funktion gibt eine Instanz der Klasse als ersten Parameter zu nehmen, weil Sie es über seinen Typ referenzieren (' aToto .dynamischerTyp'). Das Äquivalent für "aToto.toto" ist "Toto.toto (aToto)" oder "aToto.dynamicType.toto (aToto)" – Antonio