Initializer

init(task:cachedResponse:client:)

Creates a URL protocol instance to handle the task. URLプロトコルインスタンスを作成してタスクを取り扱います。

Declaration 宣言

convenience init(task: URLSessionTask, 
  cachedResponse: CachedURLResponse?, 
          client: URLProtocolClient?)

Parameters パラメータ

task

A task containing a URL request to be performed by the protocol. プロトコルによって実行されるURLリクエストを含んでいる、あるタスク。

cachedResponse

A cached response for the task; may be nil if there is no existing cached response for the task. タスクに対するキャッシュされた応答;それはnilかもしれません、もし既存のキャッシャされた応答がそのタスクにないならば。

client

An object that provides an implementation of the URLProtocolClient protocol that this instance uses to communicate with the URL loading system. This client object is retained. あるオブジェクト、それはURLProtocolClientプロトコルの実装を提供します、それはこのインスタンスが使用してURLローディングシステムと通信するものです。このクライアントオブジェクトは保持されます。

Return Value 戻り値

The initialized protocol object. 初期化されたプロトコルオブジェクト。

Discussion 議論

Subclasses should override this method to do any custom initialization. Don’t call this method explicitly. When you register your custom protocol class, the system will initialize instances of your protocol as needed. サブクラスは、このメソッドをオーバーライドして、何らかのあつらえの初期化を行うべきです。このメソッドを明示的に呼び出さないでください。あなたがあなたのあつらえのプロトコルクラスを登録する時、システムはあなたのプロトコルのインスタンスを必要に応じて初期化するでしょう。

This initializer calls through to init(request:cachedResponse:client:). このイニシャライザは、init(request:cachedResponse:client:)に至るまで呼び出します。

See Also 参照

Creating Protocol Objects プロトコルオブジェクトを作成する