Skip to content

Instantly share code, notes, and snippets.

@ayanonagon
Created November 8, 2015 02:58
Show Gist options
  • Save ayanonagon/dada7681435bbe305095 to your computer and use it in GitHub Desktop.
Save ayanonagon/dada7681435bbe305095 to your computer and use it in GitHub Desktop.
func getLicense(URL: NSURL) throws -> License {
let legalText = try String(contentsOfURL: URL, encoding: NSUTF8StringEncoding)
let pathComponents = URL.pathComponents!
let libraryName = pathComponents[pathComponents.count - 2]
return License(libraryName: libraryName, legalText: legalText)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment