So I have converted an NSURL
to a String
.
So if I println
it looks like file:///Users/...
etc.
Later I want this
NOTICE: pay attention to the url, it's optional
and it can be nil
.
You can wrap your url in the quote to convert it to a string. You can test it in the playground.
Update for Swift 5, Xcode 11:
import Foundation
let urlString = "http://ifconfig.me"
// string to url
let url = URL(string: urlString)
//url to string
let string = "\(url)"
// if you want the path without `file` schema
// let string = "\(url.path)"