From 7c3aa8b555259710294297cb5439aaff701caef8 Mon Sep 17 00:00:00 2001 From: Kjuly Date: Fri, 29 Dec 2023 10:33:34 +0800 Subject: [PATCH] KYNearbyConnectionPeerCell.swift: Make .verticalSizeClass available for iOS only --- .../PeerCell/KYNearbyConnectionPeerCell.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/KYNearbyService/Sources/KYNearbyConnectionView/PeerCell/KYNearbyConnectionPeerCell.swift b/KYNearbyService/Sources/KYNearbyConnectionView/PeerCell/KYNearbyConnectionPeerCell.swift index 02fe0f6..7599cfc 100644 --- a/KYNearbyService/Sources/KYNearbyConnectionView/PeerCell/KYNearbyConnectionPeerCell.swift +++ b/KYNearbyService/Sources/KYNearbyConnectionView/PeerCell/KYNearbyConnectionPeerCell.swift @@ -14,7 +14,9 @@ struct KYNearbyConnectionPeerCell: View { @ObservedObject var item: KYNearbyPeerModel @EnvironmentObject var viewModel: KYNearbyConnectionViewModel +#if os(iOS) @Environment(\.verticalSizeClass) var verticalSizeClass: UserInterfaceSizeClass? +#endif @State var isPresentingActions: Bool = false @@ -50,11 +52,15 @@ struct KYNearbyConnectionPeerCell: View { // MARK: - Private private func _isCompactWidth() -> Bool { +#if os(macOS) + return false +#else if KYNearbyConnectionView.isCompactDevice { return self.verticalSizeClass != .compact } else { return false } +#endif } private func _statusColor() -> Color {