title: Create Directory in Swift 3.0
body: <p>I am a new student in 9th grade learning <strong>swift</strong>, creating a school project .</p>
  
  <p>I am trying to create a directory where I want to save a scanned file into pdf format.</p>
  
  <p>While creating directory I am getting error below.</p>
  
  <p>Error 1: </p>
  
  <blockquote>
    <p>Cannot use instance member 'filemgr' within property initializer; property initializers run before 'self' is available.</p>
  </blockquote>
  
  <p>Error 2:</p>
  
  <blockquote>
    <p>Expected declaration </p>
  </blockquote>
  
  <p>Code:</p>
  
  <pre><code>let filemgr = FileManager.default
  
  
  let dirPaths = filemgr.urls(for: .documentDirectory, in: .userDomainMask)
  
  let docsURL = dirPaths[0]
  
  let newDir = docsURL.appendingPathComponent("data").path
  
  do{
      try filemgr.createDirectory(atPath: newDir,withIntermediateDirectories: true, attributes: nil)
  } catch {
      print("Error: \(error.localizedDescription)")
  }
  </code></pre>
  
  <p>Please assist me in resolving this issue.</p>
  
  <p>Thanks.</p>