title: reusing security scoped bookmark
body: <p>In my app, I would like to access local file directory with security-scoped bookmark. <p> 
  As mentioned in <a href="https://developer.apple.com/library/mac/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html" rel="noreferrer">App Sandbox Design Guide</a>, I store my user's specified folder (NSOpenPanel) in security-scoped bookmark (as NSData). </p></p>
  
  <p> However, I find <a href="https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/index.html#//apple_ref/occ/instm/NSURL/startAccessingSecurityScopedResource" rel="noreferrer">URLByResolvingBookmarkData</a> is no longer available in Swift.
  
  I have no idea how can I access the url and grant the permission to the directory I previously chosen after relaunching my app. Any ideas?</p>
  
  <pre><code>/// OpenPanel and set the folderPath
  var folderPath: NSURL? {
      didSet {
          do {
              let bookmark = try folderPath?.bookmarkDataWithOptions(.SecurityScopeAllowOnlyReadAccess, includingResourceValuesForKeys: nil, relativeToURL: nil)
  
          } catch  {
              print("Set bookMark fails")
          }
      }
  }
  </code></pre>