Skip to content

Instantly share code, notes, and snippets.

@sandofsky
Created October 5, 2017 23:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sandofsky/428dba2f495c764ce6165b7d24acfb9c to your computer and use it in GitHub Desktop.
Save sandofsky/428dba2f495c764ce6165b7d24acfb9c to your computer and use it in GitHub Desktop.
import AVFoundation
import UIKit
class ViewController: UIViewController {
var discoverSession:MyDiscoverySession = AVCaptureDevice.DiscoverySession(deviceTypes: [.builtInDualCamera, .builtInWideAngleCamera, .builtInTelephotoCamera], mediaType: .video, position: .back)
@IBAction func didTapCrashButton(_ sender: Any) {
let devices = discoverSession.myDevices
print("Got devices: \(devices)")
}
}
protocol MyDevice:class {
}
protocol MyDiscoverySession:class {
var myDevices:[MyDevice] { get }
}
extension AVCaptureDevice:MyDevice {
}
extension AVCaptureDevice.DiscoverySession: MyDiscoverySession {
var myDevices:[MyDevice] {
return self.devices
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment