init?(string: String)
init?(string: String, relativeTo : URL?)
Availability 有効性
Technology
struct URL
You can construct URLs and access their parts. For URLs that represent local files, you can also manipulate properties of those files directly, such as changing the file’s last modification date. Finally, you can pass URLs to other APIs to retrieve the contents of those URLs.
あなたは、URLを組み立てるそしてそれの部分にアクセスすることができます。ローカルファイルを表すURLに対しては、あなたはまたそれらのファイルのプロパティを直接に操作できます、例えばファイルの持つ最終修正日を変更するなど。最終的に、あなたはURLを他のAPIに渡して、それらURLの内容を回収できます。
For example, you can use URLSession
and its related classes to access the contents of remote resources.
URLs are the preferred way to refer to local files. Most objects that read data from or write data to a file have methods that accept a URL instead of a pathname as the file reference.
URLは、ローカルファイルを参照する好ましい方法です。ファイルからデータを読み出すまたはそれへとデータを書き込むほとんどのオブジェクトは、URLをパス名の代わりにファイル参照として受け入れるメソッドを持ちます。
For example, you can get the contents of a local file URL as String
by calling init(contents
, or as a Data
by calling init(contents
.
As a convenience, you can use Swift’s async
-await
syntax to asynchronously access the contents of a URL
through the resource
and lines
properties. These properties use the shared URLSession
instance to load the resoruce.
init?(string: String)
init?(string: String, relativeTo : URL?)
init(fileURLWithPath : String)
init(fileURLWithPath : String, isDirectory : Bool)
init(fileURLWithPath : String, relativeTo : URL?)
init(fileURLWithPath : String, isDirectory : Bool, relativeTo : URL?)
init(fileURLWithFileSystemRepresentation : UnsafePointer<Int8>, isDirectory : Bool, relativeTo : URL?)
init(fileReferenceLiteralResourceName : String)
init(resolvingBookmarkData : Data, options: URL.BookmarkResolutionOptions, relativeTo : URL?, bookmarkDataIsStale : inout Bool)
init(resolvingAliasFileAt : URL, options: URL.BookmarkResolutionOptions)
typealias URL.BookmarkResolutionOptions
struct NSURL.BookmarkResolutionOptions
init(from: Decoder)
func encode(to: Encoder)
init?(dataRepresentation : Data, relativeTo : URL?, isAbsolute : Bool)
var dataRepresentation : Data
var absoluteString : String
var absoluteURL : URL
var baseURL : URL?
var fragment: String?
var host: String?
var lastPathComponent : String
var path: String
var pathComponents : [String]
var pathExtension : String
var port: Int?
var query: String?
var relativePath : String
var relativeString : String
var scheme: String?
var standardized: URL
var standardizedFileURL : URL
var user: String?
var password: String?
func resourceValues (forKeys : Set<URLResourceKey>) -> URLResourceValues
func setResourceValues (URLResourceValues)
func removeCachedResourceValue (forKey : URLResourceKey)
func removeAllCachedResourceValues ()
func setTemporaryResourceValue (Any, forKey : URLResourceKey)
struct URLResourceKey
struct URLResourceValues
var isFileURL : Bool
file:
.
あるブール値、それはスキームがfile:
であるならばtrueです。
var hasDirectoryPath : Bool
func withUnsafeFileSystemRepresentation <ResultType>((UnsafePointer<Int8>?) -> ResultType) -> ResultType
func resolveSymlinksInPath ()
func resolvingSymlinksInPath () -> URL
func standardize()
func appendPathComponent (String)
func appendPathComponent (String, isDirectory : Bool)
func appendingPathComponent (String) -> URL
func appendingPathComponent (String, isDirectory : Bool) -> URL
func appendPathExtension (String)
func appendingPathExtension (String) -> URL
func deleteLastPathComponent ()
func deletingLastPathComponent () -> URL
func deletePathExtension ()
func deletingPathExtension () -> URL
func bookmarkData (options: URL.BookmarkCreationOptions, includingResourceValuesForKeys : Set<URLResourceKey>?, relativeTo : URL?) -> Data
static func bookmarkData (withContentsOf : URL) -> Data
static func writeBookmarkData (Data, to: URL)
static func resourceValues (forKeys : Set<URLResourceKey>, fromBookmarkData : Data) -> URLResourceValues?
typealias URL.BookmarkCreationOptions
struct NSURL.BookmarkCreationOptions
func checkResourceIsReachable () -> Bool
var resourceBytes : URL.AsyncBytes
var lines: AsyncLineSequence<URL.AsyncBytes>
struct URL.AsyncBytes
func checkPromisedItemIsReachable () -> Bool
func promisedItemResourceValues (forKeys : Set<URLResourceKey>) -> URLResourceValues
func startAccessingSecurityScopedResource () -> Bool
func stopAccessingSecurityScopedResource ()
static func != (URL, URL) -> Bool
static func == (URL, URL) -> Bool
var description: String
var debugDescription : String
var customPlaygroundQuickLook : PlaygroundQuickLook
var hashValue : Int
func hash(into: inout Hasher)
typealias URL.ReferenceType
struct URLComponents
struct URLQueryItem