Created
October 5, 2017 23:32
-
-
Save sandofsky/428dba2f495c764ce6165b7d24acfb9c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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