diff --git a/app/xcode/Package.swift b/app/xcode/Package.swift index 3102da2..47dcd7b 100644 --- a/app/xcode/Package.swift +++ b/app/xcode/Package.swift @@ -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"]), @@ -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)), ] } diff --git a/app/xcode/Sources/VCamCamera/Camera.swift b/app/xcode/Sources/VCamCamera/Camera.swift index 6d5fd02..4f01a3d 100644 --- a/app/xcode/Sources/VCamCamera/Camera.swift +++ b/app/xcode/Sources/VCamCamera/Camera.swift @@ -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" } } @@ -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() { diff --git a/app/xcode/Sources/VCamCamera/CoreMediaSinkStream.swift b/app/xcode/Sources/VCamCamera/CoreMediaSinkStream.swift index e375288..a1c0323 100644 --- a/app/xcode/Sources/VCamCamera/CoreMediaSinkStream.swift +++ b/app/xcode/Sources/VCamCamera/CoreMediaSinkStream.swift @@ -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") } diff --git a/app/xcode/Sources/VCamUI/CaptureDeviceRenderer+UI.swift b/app/xcode/Sources/VCamUI/CaptureDeviceRenderer+UI.swift index af7b3a8..6586999 100644 --- a/app/xcode/Sources/VCamUI/CaptureDeviceRenderer+UI.swift +++ b/app/xcode/Sources/VCamUI/CaptureDeviceRenderer+UI.swift @@ -62,7 +62,7 @@ private struct CaptureDeviceSelectView: View { .onAppear { cropPreviewWidth = proxy.size.width } - .onChange(of: preview.size) { _ in + .onChange(of: preview.size) { _, _ in cropPreviewWidth = proxy.size.width } }) @@ -70,7 +70,7 @@ private struct CaptureDeviceSelectView: View { } } .frame(minWidth: 640, minHeight: 480) - .onChange(of: captureDevice) { _ in + .onChange(of: captureDevice) { _, _ in previewer?.stop() previewer?.didOutput = nil startPreview() diff --git a/app/xcode/Sources/VCamUI/ImageFilterView.swift b/app/xcode/Sources/VCamUI/ImageFilterView.swift index 019c926..332b7d6 100644 --- a/app/xcode/Sources/VCamUI/ImageFilterView.swift +++ b/app/xcode/Sources/VCamUI/ImageFilterView.swift @@ -41,7 +41,7 @@ public struct ImageFilterView: View { filters = configuration?.filters ?? [] updatePreview() } - .onChange(of: filters) { newValue in + .onChange(of: filters) { _, newValue in updatePreview() } } diff --git a/app/xcode/Sources/VCamUI/RootView.swift b/app/xcode/Sources/VCamUI/RootView.swift index b359e38..f06cd05 100644 --- a/app/xcode/Sources/VCamUI/RootView.swift +++ b/app/xcode/Sources/VCamUI/RootView.swift @@ -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 @@ -96,6 +92,12 @@ private struct UnityView: View, Equatable { } } +extension UnityView: Equatable { + static func == (lhs: Self, rhs: Self) -> Bool { + true + } +} + #Preview { RootView( unityView: NSView(), diff --git a/app/xcode/Sources/VCamUI/ScalableViewModifier.swift b/app/xcode/Sources/VCamUI/ScalableViewModifier.swift index 956f9ec..d765895 100644 --- a/app/xcode/Sources/VCamUI/ScalableViewModifier.swift +++ b/app/xcode/Sources/VCamUI/ScalableViewModifier.swift @@ -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() } } @@ -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) } } diff --git a/app/xcode/Sources/VCamUI/ScreenRecorderPreferenceView.swift b/app/xcode/Sources/VCamUI/ScreenRecorderPreferenceView.swift index 7d82242..fd08271 100644 --- a/app/xcode/Sources/VCamUI/ScreenRecorderPreferenceView.swift +++ b/app/xcode/Sources/VCamUI/ScreenRecorderPreferenceView.swift @@ -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) } diff --git a/app/xcode/Sources/VCamUI/Settings/VCamSettingGeneralView.swift b/app/xcode/Sources/VCamUI/Settings/VCamSettingGeneralView.swift index 0ca22bb..6b497d8 100644 --- a/app/xcode/Sources/VCamUI/Settings/VCamSettingGeneralView.swift +++ b/app/xcode/Sources/VCamUI/Settings/VCamSettingGeneralView.swift @@ -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 } diff --git a/app/xcode/Sources/VCamUI/Settings/VCamSettingView.swift b/app/xcode/Sources/VCamUI/Settings/VCamSettingView.swift index c31d31c..fd51e94 100644 --- a/app/xcode/Sources/VCamUI/Settings/VCamSettingView.swift +++ b/app/xcode/Sources/VCamUI/Settings/VCamSettingView.swift @@ -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 } diff --git a/app/xcode/Sources/VCamUI/Settings/VCamSettingsIntegrationView.swift b/app/xcode/Sources/VCamUI/Settings/VCamSettingsIntegrationView.swift index f8b2fb7..aa104ac 100644 --- a/app/xcode/Sources/VCamUI/Settings/VCamSettingsIntegrationView.swift +++ b/app/xcode/Sources/VCamUI/Settings/VCamSettingsIntegrationView.swift @@ -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() @@ -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) } diff --git a/app/xcode/Sources/VCamUI/Shortcut/VCamShortcutBuilderView.swift b/app/xcode/Sources/VCamUI/Shortcut/VCamShortcutBuilderView.swift index 1b0ec23..d264ae2 100644 --- a/app/xcode/Sources/VCamUI/Shortcut/VCamShortcutBuilderView.swift +++ b/app/xcode/Sources/VCamUI/Shortcut/VCamShortcutBuilderView.swift @@ -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) } diff --git a/app/xcode/Sources/VCamUI/UIComponent/ValueEditField.swift b/app/xcode/Sources/VCamUI/UIComponent/ValueEditField.swift index d031468..74fbb48 100644 --- a/app/xcode/Sources/VCamUI/UIComponent/ValueEditField.swift +++ b/app/xcode/Sources/VCamUI/UIComponent/ValueEditField.swift @@ -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 { diff --git a/app/xcode/Sources/VCamUI/VCamSceneListView.swift b/app/xcode/Sources/VCamUI/VCamSceneListView.swift index a0c72f8..156bf98 100644 --- a/app/xcode/Sources/VCamUI/VCamSceneListView.swift +++ b/app/xcode/Sources/VCamUI/VCamSceneListView.swift @@ -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 } @@ -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 diff --git a/app/xcode/Sources/VCamUI/WebRenderer+UI.swift b/app/xcode/Sources/VCamUI/WebRenderer+UI.swift index b013998..207badf 100644 --- a/app/xcode/Sources/VCamUI/WebRenderer+UI.swift +++ b/app/xcode/Sources/VCamUI/WebRenderer+UI.swift @@ -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) } @@ -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 } }