Ist es möglich, ein Objekt auf einen Typ zu werfen, der in einer Member-Variable gespeichert ist?Typ Casting mit Typ Variable
ich das versucht habe:
let targetClass = type(of: MyTargetClass)
...
if anyObject is targetClass { // ERROR: use of undeclared type 'targetClass'
let test = anyObject as! targetClass // ERROR: use of undeclared type 'targetClass'
}
Aber es funktioniert nicht, weil sie sagt: „Verwendung von Schwarz Typ‚target‘“