iOS Comment obtenir le dernier composant de chaîne de l'URL (NSURL) dans Swift


Exemple

Swift 2.3

let url = NSURL(string: "http://google.com/lastPath")
let lastPath = url?.lastPathComponent

Swift 3.0

  let url = URL(string: "http://google.com/lastPath")
  let lastPath = url?.lastPathComponent