Skip to content

Latest commit

 

History

History
30 lines (18 loc) · 930 Bytes

README.md

File metadata and controls

30 lines (18 loc) · 930 Bytes

URL

URL is a freestanding Swift macro that provides an unwrapped Foundation URL for the string literal argument. The macro checks the validity of the literal and throws an error if it does not represent a valid Foundation URL.

Usage

import URL

let url = #URL("https://www.apple.com")

This will automatically generate the following code:

URL(string: "https://www.apple.com")!

Installation

The package can be installed using Swift Package Manager. To add URL to your Xcode project, select File > Add Package Dependancies... and search for the repository URL: https://github.com/davidsteppenbeck/URL.git.

License

URL is available under the MIT license. See the LICENSE file for more info.

Acknowledgements

The URL macro example is described in detail in Antoine v.d. Lee's blog post.