Instance Property インスタンスプロパティ

url

A URL object derived from the components object. 構成要素オブジェクトから引き出されるURLオブジェクト。

Declaration 宣言

var url: URL? { get }

Discussion 議論

If the receiver has an authority component (user, password, host, or port) and a path component, then the path must either begin with "/" or be an empty string. Otherwise, this property contains nil. レシーバがauthority構成要素(ユーザ、パスワード、ホスト、またはポート)とパス構成要素を持つならば、そのときパスは"/"で始まるかまたは空の文字列かどちらかでなければなりません。そうでなければ、このプロパティはnilを含みます。

If the receiver does not have an authority component (user, password, host, or port) and has a path component, the path component must not start with "//". If it does, this property contains nil. レシーバがauthority構成要素(ユーザ、パスワード、ホスト、またはポート)を持っていないそしてパス構成要素を持つならば、パス構成要素は"//"で始まってはいけません。そうするならば、このプロパティはnilを含みます。

If the receiver has nil values for all component properties, such as when initializing with init(), this property returns an NSURL object with an empty string, because a URL always has a path—even if it’s an empty string. レシーバがnil値を全ての構成要素プロパティに対して持つならば、例えばinit()で初期化する場合など、このプロパティは空の文字列を持つNSURLオブジェクトを返します、なぜならURLは常にパスを持つからです — たとえそれが空の文字列であるとしても。

This property can be used only to obtain a URL based on the values of the other properties. To configure a components object based on an existing URL, call either the componentsWithURL:resolvingAgainstBaseURL: or init(url:resolvingAgainstBaseURL:) method. このプロパティは、他のプロパティの値に基づいてURLを入手するためにのみ使われることができます。既存のURLに基づいて構成要素オブジェクトを構成設定するには、componentsWithURL:resolvingAgainstBaseURL:またはinit(url:resolvingAgainstBaseURL:)メソッドのどちらかを呼び出してください。

See Also 参照

Getting the URL URLを取得する