title: URLResourceValue and setResourceValues Swift 3
body: <p>I'm trying to figure out how i should proceed fox fixing below code using Swift 3.</p>
  
  <pre><code>let paths = NSSearchPathForDirectoriesInDomains(.libraryDirectory, .userDomainMask, true) as NSArray
  
  for path in paths {
      let dir = path as! String
      print("the paths are \(path)")
      let urlToExclude = NSURL.fileURL(withPath: dir)
      do {
  
          try urlToExclude.setResourceValue(NSNumber(value: true), forKey: URLResourceKey.isExcludedFromBackupKey)
  
      } catch { print("failed to set resource value") }
  }
  </code></pre>
  
  <p>The error that i'm getting is <img src="https://i.stack.imgur.com/MSbp2.png" alt="this"></p>
  
  <p>I used the above code for excluding files from backing up to the iCloud and it used to work fine for previous version of Swift but after updating to Xcode 8 I'm just stuck.</p>
  
  <p>I would really appreciate any help or suggestions.</p>