From 09db3e8ec77deda5301285c51baf6f33a1a2ced8 Mon Sep 17 00:00:00 2001 From: Schwifty Date: Sun, 22 Mar 2026 19:40:51 +0000 Subject: [PATCH] fix: resolve ambiguous color references by removing ShapeStyle extension The ShapeStyle where Self == Color extension duplicated Color statics, causing 'ambiguous use' errors in foregroundStyle/stroke/tint/background contexts. Removed the extension entirely and use explicit Color.xxx prefix at all call sites instead. --- PayfritBeacon/Utils/BrandColors.swift | 10 ---------- PayfritBeacon/Views/BusinessListView.swift | 2 +- PayfritBeacon/Views/DevBanner.swift | 2 +- PayfritBeacon/Views/LoginView.swift | 4 ++-- PayfritBeacon/Views/QRScannerView.swift | 8 ++++---- PayfritBeacon/Views/ScanView.swift | 12 ++++++------ 6 files changed, 14 insertions(+), 24 deletions(-) diff --git a/PayfritBeacon/Utils/BrandColors.swift b/PayfritBeacon/Utils/BrandColors.swift index d08e337..dac7a7e 100644 --- a/PayfritBeacon/Utils/BrandColors.swift +++ b/PayfritBeacon/Utils/BrandColors.swift @@ -4,16 +4,6 @@ import SwiftUI /// Primary: #22B24B (Payfrit Green) /// Dark: #1A8A3A -// MARK: - ShapeStyle convenience (resolves ambiguous dot-syntax in foregroundStyle/background) -extension ShapeStyle where Self == Color { - static var warningOrange: Color { Color.warningOrange } - static var errorRed: Color { Color.errorRed } - static var successGreen: Color { Color.successGreen } - static var infoBlue: Color { Color.infoBlue } - static var payfritGreen: Color { Color.payfritGreen } - static var payfritGreenDark: Color { Color.payfritGreenDark } -} - extension Color { // MARK: - Brand static let payfritGreen = Color(red: 0x22/255.0, green: 0xB2/255.0, blue: 0x4B/255.0) diff --git a/PayfritBeacon/Views/BusinessListView.swift b/PayfritBeacon/Views/BusinessListView.swift index fab8cda..74efd03 100644 --- a/PayfritBeacon/Views/BusinessListView.swift +++ b/PayfritBeacon/Views/BusinessListView.swift @@ -26,7 +26,7 @@ struct BusinessListView: View { VStack(spacing: 12) { Image(systemName: "exclamationmark.triangle") .font(.system(size: 48)) - .foregroundStyle(.warningOrange) + .foregroundStyle(Color.warningOrange) Text("Error") .font(.headline) Text(error) diff --git a/PayfritBeacon/Views/DevBanner.swift b/PayfritBeacon/Views/DevBanner.swift index 2634a09..5330b72 100644 --- a/PayfritBeacon/Views/DevBanner.swift +++ b/PayfritBeacon/Views/DevBanner.swift @@ -8,7 +8,7 @@ struct DevBanner: View { .foregroundStyle(.white) .padding(.horizontal, 12) .padding(.vertical, 4) - .background(.warningOrange, in: Capsule()) + .background(Color.warningOrange, in: Capsule()) .padding(.top, 4) } } diff --git a/PayfritBeacon/Views/LoginView.swift b/PayfritBeacon/Views/LoginView.swift index b254f83..4704494 100644 --- a/PayfritBeacon/Views/LoginView.swift +++ b/PayfritBeacon/Views/LoginView.swift @@ -20,7 +20,7 @@ struct LoginView: View { // Logo Image(systemName: "antenna.radiowaves.left.and.right") .font(.system(size: 64)) - .foregroundStyle(.payfritGreen) + .foregroundStyle(Color.payfritGreen) Text("Payfrit Beacon") .font(.title.bold()) @@ -49,7 +49,7 @@ struct LoginView: View { if let error = errorMessage { Text(error) .font(.caption) - .foregroundStyle(.errorRed) + .foregroundStyle(Color.errorRed) } Button(action: handleAction) { diff --git a/PayfritBeacon/Views/QRScannerView.swift b/PayfritBeacon/Views/QRScannerView.swift index 8c6434b..4b9e830 100644 --- a/PayfritBeacon/Views/QRScannerView.swift +++ b/PayfritBeacon/Views/QRScannerView.swift @@ -101,7 +101,7 @@ struct QRScannerView: View { p.addLine(to: CGPoint(x: 0, y: 0)) p.addLine(to: CGPoint(x: corner, y: 0)) } - .stroke(.payfritGreen, lineWidth: thickness) + .stroke(Color.payfritGreen, lineWidth: thickness) // Top-right Path { p in @@ -109,7 +109,7 @@ struct QRScannerView: View { p.addLine(to: CGPoint(x: w, y: 0)) p.addLine(to: CGPoint(x: w, y: corner)) } - .stroke(.payfritGreen, lineWidth: thickness) + .stroke(Color.payfritGreen, lineWidth: thickness) // Bottom-left Path { p in @@ -117,7 +117,7 @@ struct QRScannerView: View { p.addLine(to: CGPoint(x: 0, y: h)) p.addLine(to: CGPoint(x: corner, y: h)) } - .stroke(.payfritGreen, lineWidth: thickness) + .stroke(Color.payfritGreen, lineWidth: thickness) // Bottom-right Path { p in @@ -125,7 +125,7 @@ struct QRScannerView: View { p.addLine(to: CGPoint(x: w, y: h)) p.addLine(to: CGPoint(x: w, y: h - corner)) } - .stroke(.payfritGreen, lineWidth: thickness) + .stroke(Color.payfritGreen, lineWidth: thickness) } } diff --git a/PayfritBeacon/Views/ScanView.swift b/PayfritBeacon/Views/ScanView.swift index 94d77af..e41aa97 100644 --- a/PayfritBeacon/Views/ScanView.swift +++ b/PayfritBeacon/Views/ScanView.swift @@ -174,7 +174,7 @@ struct ScanView: View { VStack(spacing: 12) { Image(systemName: "exclamationmark.triangle") .font(.system(size: 48)) - .foregroundStyle(.warningOrange) + .foregroundStyle(Color.warningOrange) Text("Namespace Error") .font(.headline) Text(errorMessage ?? "Failed to allocate beacon namespace") @@ -240,7 +240,7 @@ struct ScanView: View { if bleManager.bluetoothState != .poweredOn { Label("Bluetooth Off", systemImage: "bluetooth.slash") .font(.caption) - .foregroundStyle(.errorRed) + .foregroundStyle(Color.errorRed) } } .padding(.horizontal) @@ -323,7 +323,7 @@ struct ScanView: View { Image(systemName: "light.beacon.max") .font(.system(size: 64)) - .foregroundStyle(.payfritGreen) + .foregroundStyle(Color.payfritGreen) .modifier(PulseEffectModifier()) Text("Beacon is Flashing") @@ -345,7 +345,7 @@ struct ScanView: View { .frame(maxWidth: .infinity) } .buttonStyle(.borderedProminent) - .tint(.payfritGreen) + .tint(Color.payfritGreen) .controlSize(.large) .padding(.horizontal, 32) @@ -379,7 +379,7 @@ struct ScanView: View { Spacer() Image(systemName: "checkmark.circle.fill") .font(.system(size: 64)) - .foregroundStyle(.successGreen) + .foregroundStyle(Color.successGreen) Text("Beacon Provisioned!") .font(.title2.bold()) Text(statusMessage) @@ -400,7 +400,7 @@ struct ScanView: View { Spacer() Image(systemName: "xmark.circle.fill") .font(.system(size: 64)) - .foregroundStyle(.errorRed) + .foregroundStyle(Color.errorRed) Text("Provisioning Failed") .font(.title2.bold()) Text(errorMessage ?? "Unknown error")