2017-02-14から1日間の記事一覧
ある型(class/struct)のインスタンスを使って型メソッドを呼ぶには、type(of:)関数を使います。 class Foo { static var bar: Int { return 100 } } let foo = Foo() foo.bar // error: static member 'bar' cannot be used on instance of type 'Foo' type(…
ある型(class/struct)のインスタンスを使って型メソッドを呼ぶには、type(of:)関数を使います。 class Foo { static var bar: Int { return 100 } } let foo = Foo() foo.bar // error: static member 'bar' cannot be used on instance of type 'Foo' type(…