Instance Method インスタンスメソッド

registerCoercer(_:selector:toConvertFrom:to:)

Registers a given object (typically a class) to handle coercions (conversions) from one given class to another. 与えられたオブジェクト(概してあるクラス)を登録して、ある与えられたクラスから別のものへの強制(変換)を取り扱うようにします。

Declaration 宣言

func registerCoercer(_ coercer: Any, 
            selector: Selector, 
       toConvertFrom fromClass: AnyClass, 
                  to toClass: AnyClass)

Parameters パラメータ

coercer

The object that performs the coercion. coercer should typically be a class object. 強制を実行するオブジェクト。coercerは、一般的にクラスオブジェクトであるべきです。

selector

A selector that specifies the method to perform the coercion. selector should typically be a factory method, and must take two arguments. The first is the value to be converted. The second is the class to convert it to. 強制を実行するためのメソッドを指定するセレクタ。selectorは、一般的にファクトリメソッドであるべきです、そして2つの引数を取らなければなりません。最初のものは、変換されることになる値です。2番目のものは、それへと変換することになるクラス。

fromClass

The class for which instances are coerced. このクラスに対してインスタンスが強制されます。

toClass

The class to which instances of fromClass are coerced. このクラスへとfromClassのインスタンスは強制されます。

See Also 参照

Working with handlers ハンドラを扱う