From 46743b514ecd3b6da37194423400324ff5fd4edf Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Wed, 16 Sep 2020 14:30:07 +0200 Subject: [PATCH] Require macOS 10.13 or later --- .../package.xcworkspace/contents.xcworkspacedata | 7 +++++++ .../xcschemes/xcschememanagement.plist | 14 ++++++++++++++ Aperture.podspec | 2 +- Package.swift | 2 +- Sources/Aperture/Aperture.swift | 11 +++++------ readme.md | 2 +- 6 files changed, 29 insertions(+), 9 deletions(-) create mode 100644 .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata create mode 100644 .swiftpm/xcode/xcuserdata/sindresorhus.xcuserdatad/xcschemes/xcschememanagement.plist diff --git a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/.swiftpm/xcode/xcuserdata/sindresorhus.xcuserdatad/xcschemes/xcschememanagement.plist b/.swiftpm/xcode/xcuserdata/sindresorhus.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..6766e26 --- /dev/null +++ b/.swiftpm/xcode/xcuserdata/sindresorhus.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + Aperture.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/Aperture.podspec b/Aperture.podspec index ec86e91..e76bf77 100644 --- a/Aperture.podspec +++ b/Aperture.podspec @@ -9,5 +9,5 @@ Pod::Spec.new do |s| s.source = { :git => 'https://github.com/wulkano/Aperture.git', :tag => "v#{s.version}" } s.source_files = 'Sources/**/*.swift' s.swift_version = '5.3' - s.platform = :macos, '10.12' + s.platform = :macos, '10.13' end diff --git a/Package.swift b/Package.swift index 91654bc..2424a6c 100644 --- a/Package.swift +++ b/Package.swift @@ -4,7 +4,7 @@ import PackageDescription let package = Package( name: "Aperture", platforms: [ - .macOS(.v10_12) + .macOS(.v10_13) ], products: [ .library( diff --git a/Sources/Aperture/Aperture.swift b/Sources/Aperture/Aperture.swift index 359b2ed..ab4122c 100644 --- a/Sources/Aperture/Aperture.swift +++ b/Sources/Aperture/Aperture.swift @@ -26,8 +26,8 @@ public final class Aperture: NSObject { destination: URL, input: AVCaptureInput, output: AVCaptureMovieFileOutput, - audioDevice: AVCaptureDevice?, - videoCodec: String? + audioDevice: AVCaptureDevice? = nil, + videoCodec: AVVideoCodecType? = nil ) throws { self.destination = destination self.session = AVCaptureSession() @@ -63,7 +63,7 @@ public final class Aperture: NSObject { throw Error.couldNotAddOutput } - // TODO: Default to HEVC when on 10.13 or newer and encoding is hardware supported. Without hardware encoding I got 3 FPS full screen recording. + // TODO: Default to HEVC when encoding is hardware supported. Without hardware encoding I got 3 FPS full screen recording. // TODO: Find a way to detect hardware encoding support. // Hardware encoding is supported on 6th gen Intel processor or newer. if let videoCodec = videoCodec { @@ -73,7 +73,6 @@ public final class Aperture: NSObject { super.init() } - // TODO: When targeting macOS 10.13, make the `videoCodec` option the type `AVVideoCodecType`. /** Start a capture session with the given screen ID. @@ -96,7 +95,7 @@ public final class Aperture: NSObject { highlightClicks: Bool = false, screenId: CGDirectDisplayID = .main, audioDevice: AVCaptureDevice? = .default(for: .audio), - videoCodec: String? = nil + videoCodec: AVVideoCodecType? = nil ) throws { let input = try AVCaptureScreenInput(displayID: screenId).unwrapOrThrow(Error.invalidScreen) @@ -138,7 +137,7 @@ public final class Aperture: NSObject { destination: URL, iosDevice: AVCaptureDevice, audioDevice: AVCaptureDevice? = nil, - videoCodec: String? = nil + videoCodec: AVVideoCodecType? = nil ) throws { let input = try AVCaptureDeviceInput(device: iosDevice) diff --git a/readme.md b/readme.md index 7a231e0..f0a0487 100644 --- a/readme.md +++ b/readme.md @@ -6,7 +6,7 @@ ## Requirements -- macOS 10.12+ +- macOS 10.13+ - Xcode 12+ - Swift 5.3+