Skip to content

anjlab/SafeURL

Repository files navigation

SafeURL

CI Status Version License Platform

Usage

Construct urls from scratch

NSURL.build(scheme: "tel", path: "+7 (910) 670 14 00") // #> NSURL "tel:+7%20(910)%20670%2014%2000"

Use BaseURL

let baseURL = NSURL(string: "https://google.com")!
baseURL.build(query: ["q": "Safe URL"]) // #> NSURL "https://google.com?q=Safe%20URL"

Build paths. No unsafe string interpolations

let baseURL = NSURL(string: "https://example.com/api/v1/")!
let userId = 1
baseURL.build(["users", userId]) // #> NSURL "https://example.com/api/v1/users/1"

Requirements

  • iOS 8.0+ / Mac OS X 10.10+ / tvOS 9.0+ / watchOS 2.0+
  • Xcode 7.3
  • Swift 2.2

Installation

SafeURL is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "SafeURL"

Author

Yury Korolev, [email protected]

License

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