0
私はこの機能を実現するために必要なパラメータとして、クラス型をパスし、そのインスタンスを作成します。その後
- はパラメータとしてクラス型を渡しを
- チェッククラス型
- 私が呼び出す必要がある場合インスタンスメソッド、それをインスタンス化し、
- 関数を呼び出すまたは静的クラスメソッドに
クラス
を呼び出しますclass Foo{
func method1()
}
class Bar{
static method2()
}
そして、受信方法で:
func receiveClassType(type:AnyClass){
//check class type
//If class Foo, cast received object to Foo, instantiate it and call method1()
//If class Bar, cast received class to Bar call static method method2()
}
感謝します。