NSURLComponents class is a class that is designed to parse URLs based on RFC 3986 and to construct URLs from their constituent parts. Its behavior differs subtly from the
NSURL class, which conforms to older RFCs. However, you can easily obtain an
NSURL object based on the contents of a URL components object or vice versa.
You create a URL components object in one of three ways: from an
NSString object that contains a URL, from an
NSURL object, or from scratch by using the default initializer. From there, you can modify the URL’s individual components and subcomponents by modifying various properties, either in unencoded form or in URL-encoded form. If you set the unencoded property, you can then obtain the encoded equivalent by reading the encoded property value and vice versa.