Namespace `Devices` under `Aperture`

This commit is contained in:
Sindre Sorhus 2020-02-14 18:53:01 +07:00
parent 5f80b523c1
commit 5e4c311540
2 changed files with 29 additions and 28 deletions

View File

@ -22,7 +22,6 @@ public final class Aperture: NSObject {
public var onResume: (() -> Void)?
public var isRecording: Bool { output.isRecording }
public var isPaused: Bool { output.isRecordingPaused }
public let devices = Devices.self
private init(
destination: URL,
@ -80,7 +79,7 @@ public final class Aperture: NSObject {
/**
Start a capture session with the given screen ID.
Use `Aperture.devices.screen()` to get a list of available screens.
Use `Aperture.Devices.screen()` to get a list of available screens.
Then pass the `id` property from those dictionaries to this initializer to start recording.
@ -126,7 +125,7 @@ public final class Aperture: NSObject {
/**
Start a capture session with the given iOS device.
Use `Aperture.devices.iOS()` to get a list of connected iOS devices.
Use `Aperture.Devices.iOS()` to get a list of connected iOS devices.
Use the `id` property from those dictionaries to create an `AVCaptureDevice` like in the following example:

View File

@ -14,6 +14,7 @@ private func enableDalDevices() {
CMIOObjectSetPropertyData(CMIOObjectID(kCMIOObjectSystemObject), &property, 0, nil, UInt32(sizeOfAllow), &allow)
}
extension Aperture {
public struct Devices {
public static func screen() -> [[String: Any]] {
NSScreen.screens.map {
@ -48,3 +49,4 @@ public struct Devices {
}
}
}
}