Skip to content

Commit

Permalink
Drop macOS 13 support
Browse files Browse the repository at this point in the history
  • Loading branch information
tattn committed Sep 18, 2024
1 parent 69e8766 commit a71c27a
Show file tree
Hide file tree
Showing 15 changed files with 39 additions and 37 deletions.
8 changes: 4 additions & 4 deletions app/xcode/Package.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// swift-tools-version: 5.9
// swift-tools-version: 6.0

import PackageDescription

let package = Package(
name: "VCam",
defaultLocalization: "en",
platforms: [.macOS(.v13)],
platforms: [.macOS(.v14)],
products: [
.library(name: "VCam", targets: ["VCamUI", "VCamMedia", "VCamBridge", "VCamWorkaround"]),
.library(name: "VCamMedia", targets: ["VCamMedia"]),
Expand Down Expand Up @@ -48,12 +48,12 @@ let package = Package(
.testTarget(name: "VCamCameraTests", dependencies: ["VCamCamera"]),
.testTarget(name: "VCamBridgeTests", dependencies: ["VCamBridge"]),
.testTarget(name: "VCamAppExtensionTests", dependencies: ["VCamAppExtension"]),
]
],
swiftLanguageModes: [.v5]
)

for target in package.targets {
target.swiftSettings = (target.swiftSettings ?? []) + [
.enableUpcomingFeature("ExistentialAny", .when(configuration: .debug)),
.enableUpcomingFeature("StrictConcurrency", .when(configuration: .debug)),
]
}
4 changes: 2 additions & 2 deletions app/xcode/Sources/VCamCamera/Camera.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public enum Camera {
public static func configure() {
let updateCache = {
Camera.enableDalDevices()
let deviceDiscoverySession = AVCaptureDevice.DiscoverySession(deviceTypes: [.builtInWideAngleCamera, .externalUnknown], mediaType: nil, position: .unspecified)
let deviceDiscoverySession = AVCaptureDevice.DiscoverySession(deviceTypes: [.builtInWideAngleCamera, .external], mediaType: nil, position: .unspecified)
cachedDevices = deviceDiscoverySession.devices.filter { $0.uniqueID != "vcam-device" }
}

Expand All @@ -40,7 +40,7 @@ public enum Camera {

public static var defaultCaptureDevice: AVCaptureDevice? {
AVCaptureDevice.DiscoverySession(deviceTypes: [.builtInWideAngleCamera], mediaType: .video, position: .unspecified).devices.first ??
AVCaptureDevice.DiscoverySession(deviceTypes: [.externalUnknown], mediaType: .video, position: .unspecified).devices.first
AVCaptureDevice.DiscoverySession(deviceTypes: [.external], mediaType: .video, position: .unspecified).devices.first
}

public static func enableDalDevices() {
Expand Down
2 changes: 1 addition & 1 deletion app/xcode/Sources/VCamCamera/CoreMediaSinkStream.swift
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public final class CoreMediaSinkStream: NSObject {

private static func findCameraExtensionDeviceID() -> CMIOObjectID? {
let extDevice = AVCaptureDevice.DiscoverySession(
deviceTypes: [.externalUnknown],
deviceTypes: [.external],
mediaType: .video,
position: .unspecified
).devices.first { $0.localizedName.contains("CameraExtension") }
Expand Down
4 changes: 2 additions & 2 deletions app/xcode/Sources/VCamUI/CaptureDeviceRenderer+UI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ private struct CaptureDeviceSelectView: View {
.onAppear {
cropPreviewWidth = proxy.size.width
}
.onChange(of: preview.size) { _ in
.onChange(of: preview.size) { _, _ in
cropPreviewWidth = proxy.size.width
}
})
}
}
}
.frame(minWidth: 640, minHeight: 480)
.onChange(of: captureDevice) { _ in
.onChange(of: captureDevice) { _, _ in
previewer?.stop()
previewer?.didOutput = nil
startPreview()
Expand Down
2 changes: 1 addition & 1 deletion app/xcode/Sources/VCamUI/ImageFilterView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public struct ImageFilterView: View {
filters = configuration?.filters ?? []
updatePreview()
}
.onChange(of: filters) { newValue in
.onChange(of: filters) { _, newValue in
updatePreview()
}
}
Expand Down
14 changes: 8 additions & 6 deletions app/xcode/Sources/VCamUI/RootView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,16 @@ private struct RootViewContent: View {
}
}

private struct UnityView: View, Equatable {
private struct UnityView: View {
let unityView: NSView

var body: some View {
UnityContainerView(unityView: unityView)
// .help(L10n.helpMouseHover.text)
// .help(L10n.helpMouseHover.text)
.frame(maxWidth: .infinity, maxHeight: .infinity)
.aspectRatio(1280 / 720, contentMode: .fit)
}

static func == (lhs: Self, rhs: Self) -> Bool {
true
}

private struct UnityContainerView: NSViewRepresentable {
let unityView: NSView

Expand All @@ -96,6 +92,12 @@ private struct UnityView: View, Equatable {
}
}

extension UnityView: Equatable {
static func == (lhs: Self, rhs: Self) -> Bool {
true
}
}

#Preview {
RootView(
unityView: NSView(),
Expand Down
12 changes: 6 additions & 6 deletions app/xcode/Sources/VCamUI/ScalableViewModifier.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,19 +98,19 @@ public struct ScalableViewModifier: ViewModifier {
.onAppear {
initializeRect(size: size)
}
.onChange(of: size) { size in
.onChange(of: size) { _, size in
initializeRect(size: size)
}
.onChange(of: topOffset) { _ in
.onChange(of: topOffset) { _, _ in
updateRect()
}
.onChange(of: bottomOffset) { _ in
.onChange(of: bottomOffset) { _, _ in
updateRect()
}
.onChange(of: leadingOffset) { _ in
.onChange(of: leadingOffset) { _, _ in
updateRect()
}
.onChange(of: trailingOffset) { _ in
.onChange(of: trailingOffset) { _, _ in
updateRect()
}
}
Expand Down Expand Up @@ -221,7 +221,7 @@ private struct ScalableViewModifierDemoView: View {
Color.red
.overlay(Color.blue.modifier(CropViewModifier(rect: $rect)))
.padding()
.onChange(of: rect) { newValue in
.onChange(of: rect) { _, newValue in
print(rect)
}
}
Expand Down
6 changes: 3 additions & 3 deletions app/xcode/Sources/VCamUI/ScreenRecorderPreferenceView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,17 +119,17 @@ public struct ScreenRecorderPreferenceView: View {
refreshAvailableContent()
}
}
.onChange(of: captureConfig.captureType) { _ in
.onChange(of: captureConfig.captureType) { _, _ in
Task {
await screenRecorder.update(with: captureConfig)
}
}
.onChange(of: captureConfig.display) { _ in
.onChange(of: captureConfig.display) { _, _ in
Task {
await screenRecorder.update(with: captureConfig)
}
}
.onChange(of: captureConfig.window) { _ in
.onChange(of: captureConfig.window) { _, _ in
Task {
await screenRecorder.update(with: captureConfig)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public struct VCamSettingGeneralView: View {
}
.frame(maxWidth: .infinity, alignment: .leading)
}
.onChange(of: useAddToMacOSMenuBar) { newValue in
.onChange(of: useAddToMacOSMenuBar) { _, newValue in
VCamSystem.shared.windowManager.isMacOSMenubarVisible = newValue
}

Expand Down
2 changes: 1 addition & 1 deletion app/xcode/Sources/VCamUI/Settings/VCamSettingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public struct VCamSettingView: View {
.frame(minWidth: 440)
}
.padding([.top, .trailing], 8)
.onChange(of: tab) { newValue in
.onChange(of: tab) { _, newValue in
if newValue == nil {
tab = tab
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public struct VCamSettingsIntegrationView: View {
Toggle(isOn: $integrationVCamMocap) {
Text(L10n.enable.key, bundle: .localize)
}
.onChange(of: integrationVCamMocap) { newValue in
.onChange(of: integrationVCamMocap) { _, newValue in
Task {
if newValue {
try await Tracking.shared.startVCamMotionReceiver()
Expand Down Expand Up @@ -92,7 +92,7 @@ private struct MocopiSettingView: View {
}
}
.help(L10n.helpMocopIP.text)
.onChange(of: integrationMocopi) { newValue in
.onChange(of: integrationMocopi) { _, newValue in
useFullTracking = newValue
Tracking.shared.setHandTrackingMethod(.mocopi)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public struct VCamShortcutBuilderView: View {
}
.frame(minWidth: 180)
}
.onChange(of: shortcut) { newValue in
.onChange(of: shortcut) { _, newValue in
sourceShortcut = newValue
VCamShortcutManager.shared.update(newValue)
}
Expand Down
2 changes: 1 addition & 1 deletion app/xcode/Sources/VCamUI/UIComponent/ValueEditField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public struct ValueEditField: View {
.font(.caption2)
.fontWeight(.thin)
.foregroundColor(.secondary)
.onChange(of: value) { newValue in
.onChange(of: value) { _, newValue in
debounceTask?.cancel()
debounceTask = Task {
do {
Expand Down
8 changes: 4 additions & 4 deletions app/xcode/Sources/VCamUI/VCamSceneListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public struct VCamSceneListView: View {
.onMove { source, destination in
sceneManager.move(fromOffsets: source, toOffset: destination)
}
.onChange(of: selectedId) {
guard let newId = $0 else {
.onChange(of: selectedId) { _, newValue in
guard let newId = newValue else {
selectedId = sceneManager.currentSceneId
return
}
Expand All @@ -46,8 +46,8 @@ public struct VCamSceneListView: View {
}
selectedId = newId
}
.onChange(of: sceneManager.currentSceneId) {
selectedId = $0
.onChange(of: sceneManager.currentSceneId) { _, newValue in
selectedId = newValue
}
.onAppear {
selectedId = sceneManager.currentSceneId
Expand Down
4 changes: 2 additions & 2 deletions app/xcode/Sources/VCamUI/WebRenderer+UI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public struct WebRendererPreferenceView: View {
guard let resource = resource else { return }
refreshScreen(resource: resource)
}
.onChange(of: resource) { newValue in
.onChange(of: resource) { _, newValue in
guard let resource = newValue else { return }
refreshScreen(resource: resource)
}
Expand Down Expand Up @@ -220,7 +220,7 @@ public struct WebRendererPreferenceView: View {
.onReceive(previewObserver) { image in
preview = image
}
.onChange(of: css) { newValue in
.onChange(of: css) { _, newValue in
renderer?.css = newValue
}
}
Expand Down

0 comments on commit a71c27a

Please sign in to comment.