title: How do you set a device's flash mode in Swift 4?
body: <p>I'm calling a function to attempt to turn on my device's flash:</p>
  
  <pre><code>private func flashOn(device:AVCaptureDevice)
  {
      print("flashOn called");
      do {
  
          try device.lockForConfiguration()
          // line below returns warning 'flashMode' was deprecated in iOS 10.0: Use AVCapturePhotoSettings.flashMode instead.
          device.flashMode = AVCaptureDevice.FlashMode.auto
          device.unlockForConfiguration()
  
      } catch {
  
          // handle error
          print("flash on error");
      }
  
  }
  </code></pre>
  
  <p>Setting device.flashMode to AVCaptureDevice.FlashMode.auto brings up the warning "'flashMode' was deprecated in iOS 10.0: Use AVCapturePhotoSettings.flashMode instead.". Even though it is just a warning, it does not enable the flash when testing my app, so I change that line to:</p>
  
  <pre><code>device.flashMode = AVCaptureDevice.FlashMode.auto
  </code></pre>
  
  <p>So I set the line to this, like it suggests:</p>
  
  <pre><code>AVCapturePhotoSettings.flashMode = AVCaptureDevice.FlashMode.auto
  </code></pre>
  
  <p>And I get the error "Instance member 'flashMode' cannot be used on type 'AVCapturePhotoSettings'"</p>
  
  <p>So I have no idea how to set the flash in Xcode version 9 using Swift 4.0. All the answers I've found in Stack Overflow have been for previous versions. </p>