본문 바로가기

Basics/Networking

Structure: URL

A value that identifies the location of a resource, such as an item on a remote server or the path to a local file.

 

Declaration

struct URL

 

Overview

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. For example, you can use the URLSession classes to access the contents of remote resources, as described in URL Session Programming Guide.

 

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. For example, you can get the contents of a local file URL as String by calling func init(contentsOf:encoding) throws, or as a Data by calling func init(contentsOf:options) throws.

 

developer.apple.com/documentation/foundation/url

 

Apple Developer Documentation

 

developer.apple.com

 

'Basics > Networking' 카테고리의 다른 글

Structure: URLComponents  (0) 2020.11.08
Preventing Insecure Network Connections  (0) 2020.11.07
What is URL?  (0) 2020.11.06
URLRequest  (0) 2020.10.16