diff --git a/ClerkDemo/ClerkDemo.xcodeproj/project.pbxproj b/ClerkDemo/ClerkDemo.xcodeproj/project.pbxproj index 12f561d1..10f86451 100644 --- a/ClerkDemo/ClerkDemo.xcodeproj/project.pbxproj +++ b/ClerkDemo/ClerkDemo.xcodeproj/project.pbxproj @@ -325,9 +325,13 @@ MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = com.clerk.ClerkDemo; PRODUCT_NAME = "$(TARGET_NAME)"; + SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator xros xrsimulator"; + SUPPORTS_MACCATALYST = NO; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; + SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; + TARGETED_DEVICE_FAMILY = "1,2,3,7"; }; name = Debug; }; @@ -357,9 +361,13 @@ MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = com.clerk.ClerkDemo; PRODUCT_NAME = "$(TARGET_NAME)"; + SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator xros xrsimulator"; + SUPPORTS_MACCATALYST = NO; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; + SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; + TARGETED_DEVICE_FAMILY = "1,2,3,7"; }; name = Release; }; diff --git a/Package.swift b/Package.swift index 42e07244..3fe0e3c4 100644 --- a/Package.swift +++ b/Package.swift @@ -5,10 +5,7 @@ import PackageDescription let package = Package( name: "Clerk", - platforms: [ - .iOS(.v16), - .macOS(.v13) - ], + platforms: [.iOS(.v16), .macCatalyst(.v13), .macOS(.v13), .watchOS(.v9), .tvOS(.v16), .visionOS(.v1)], products: [ // Products define the executables and libraries a package produces, making them visible to other packages. .library( diff --git a/Sources/API/Models/PhoneNumber.swift b/Sources/API/Models/PhoneNumber.swift index 53f5909a..103b80a4 100644 --- a/Sources/API/Models/PhoneNumber.swift +++ b/Sources/API/Models/PhoneNumber.swift @@ -58,12 +58,15 @@ extension PhoneNumber { let phoneNumberKit = Container.shared.phoneNumberKit() guard let phoneNumber = try? phoneNumberKit.parse(phoneNumber) else { return phoneNumber } + #if canImport(UIKit) + if let region = phoneNumber.regionID, let country = CountryCodePickerViewController.Country(for: region, with: phoneNumberKit) { return country.flag } + #endif return nil } diff --git a/Sources/API/Utils/UserAgentHelpers.swift b/Sources/API/Utils/UserAgentHelpers.swift index 3ddbf7ca..ebdb0d36 100644 --- a/Sources/API/Utils/UserAgentHelpers.swift +++ b/Sources/API/Utils/UserAgentHelpers.swift @@ -6,7 +6,6 @@ // import Foundation -import UIKit struct UserAgentHelpers { diff --git a/Sources/UI/Common/AuthProviderIcon.swift b/Sources/UI/Common/AuthProviderIcon.swift index f469ef0d..919dde67 100644 --- a/Sources/UI/Common/AuthProviderIcon.swift +++ b/Sources/UI/Common/AuthProviderIcon.swift @@ -5,6 +5,8 @@ // Created by Mike Pitre on 3/6/24. // +#if canImport(UIKit) + import SwiftUI import NukeUI @@ -31,3 +33,5 @@ struct AuthProviderIcon: View { #Preview { AuthProviderIcon(provider: .apple) } + +#endif diff --git a/Sources/UI/Common/CheckBoxView.swift b/Sources/UI/Common/CheckBoxView.swift index bf82699d..1a36df15 100644 --- a/Sources/UI/Common/CheckBoxView.swift +++ b/Sources/UI/Common/CheckBoxView.swift @@ -5,6 +5,8 @@ // Created by Mike Pitre on 12/19/23. // +#if canImport(UIKit) + import SwiftUI struct CheckBoxView: View { @@ -58,3 +60,5 @@ struct CheckBoxView: View { CheckBoxView(isSelected: .constant(true)) .frame(width: 40, height: 40) } + +#endif diff --git a/Sources/UI/Common/ErrorPresentation.swift b/Sources/UI/Common/ErrorPresentation.swift index 37c329f8..cb58161e 100644 --- a/Sources/UI/Common/ErrorPresentation.swift +++ b/Sources/UI/Common/ErrorPresentation.swift @@ -5,6 +5,8 @@ // Created by Mike Pitre on 12/11/23. // +#if canImport(UIKit) + import SwiftUI struct ErrorWrapper: Identifiable { @@ -77,3 +79,5 @@ extension View { .presentationDragIndicator(.visible) } } + +#endif diff --git a/Sources/UI/Common/GetHelpView.swift b/Sources/UI/Common/GetHelpView.swift index 34cd606d..34eb20b1 100644 --- a/Sources/UI/Common/GetHelpView.swift +++ b/Sources/UI/Common/GetHelpView.swift @@ -5,6 +5,8 @@ // Created by Mike Pitre on 1/17/24. // +#if canImport(UIKit) + import SwiftUI struct GetHelpView: View { @@ -68,3 +70,5 @@ struct GetHelpView: View { primaryButtonConfig: .init(label: "Email support", action: {}), secondaryButtonConfig: .init(label: "Back to sign in", action: {})) } + +#endif diff --git a/Sources/UI/Common/MoreActionsView.swift b/Sources/UI/Common/MoreActionsView.swift index c7944b9a..86fd924e 100644 --- a/Sources/UI/Common/MoreActionsView.swift +++ b/Sources/UI/Common/MoreActionsView.swift @@ -5,6 +5,8 @@ // Created by Mike Pitre on 1/11/24. // +#if canImport(UIKit) + import SwiftUI struct MoreActionsView: View { @@ -23,3 +25,5 @@ struct MoreActionsView: View { #Preview { MoreActionsView() } + +#endif diff --git a/Sources/UI/Common/OrgLogoView.swift b/Sources/UI/Common/OrgLogoView.swift index 4dbcd72e..e2c9e497 100644 --- a/Sources/UI/Common/OrgLogoView.swift +++ b/Sources/UI/Common/OrgLogoView.swift @@ -5,6 +5,8 @@ // Created by Mike Pitre on 12/18/23. // +#if canImport(UIKit) + import SwiftUI import NukeUI @@ -29,3 +31,5 @@ public struct OrgLogoView: View { OrgLogoView() .frame(width: 32, height: 32) } + +#endif diff --git a/Sources/UI/Common/RemoveResourceView.swift b/Sources/UI/Common/RemoveResourceView.swift index 5d1bdf93..997c5874 100644 --- a/Sources/UI/Common/RemoveResourceView.swift +++ b/Sources/UI/Common/RemoveResourceView.swift @@ -5,6 +5,8 @@ // Created by Mike Pitre on 11/8/23. // +#if canImport(UIKit) + import SwiftUI struct RemoveResourceView: View { @@ -69,3 +71,5 @@ struct RemoveResourceView: View { print("DELETED") } } + +#endif diff --git a/Sources/UI/Components/User/UserProfile/UserProfileMfaAddSmsView.swift b/Sources/UI/Components/User/UserProfile/UserProfileMfaAddSmsView.swift index 48c5e7ac..57fa3ad7 100644 --- a/Sources/UI/Components/User/UserProfile/UserProfileMfaAddSmsView.swift +++ b/Sources/UI/Components/User/UserProfile/UserProfileMfaAddSmsView.swift @@ -5,6 +5,8 @@ // Created by Mike Pitre on 1/25/24. // +#if canImport(UIKit) + import SwiftUI struct UserProfileMfaAddSmsView: View { @@ -142,3 +144,5 @@ struct UserProfileMfaAddSmsView: View { #Preview { UserProfileMfaAddSmsView() } + +#endif diff --git a/Sources/UI/Components/User/UserProfile/UserProfileMfaAddTotpView.swift b/Sources/UI/Components/User/UserProfile/UserProfileMfaAddTotpView.swift index 82cb9e5d..45e2ca6f 100644 --- a/Sources/UI/Components/User/UserProfile/UserProfileMfaAddTotpView.swift +++ b/Sources/UI/Components/User/UserProfile/UserProfileMfaAddTotpView.swift @@ -5,6 +5,8 @@ // Created by Mike Pitre on 2/13/24. // +#if canImport(UIKit) + import SwiftUI extension UserProfileMfaAddTotpView { @@ -270,3 +272,5 @@ private struct TOTPBackupCodesView: View { "flwmkdcp" ]) } + +#endif diff --git a/Sources/UI/Components/User/UserProfile/UserProfileMfaBackupCodeListView.swift b/Sources/UI/Components/User/UserProfile/UserProfileMfaBackupCodeListView.swift index 15b004f9..af552716 100644 --- a/Sources/UI/Components/User/UserProfile/UserProfileMfaBackupCodeListView.swift +++ b/Sources/UI/Components/User/UserProfile/UserProfileMfaBackupCodeListView.swift @@ -5,6 +5,8 @@ // Created by Mike Pitre on 1/29/24. // +#if canImport(UIKit) + import SwiftUI struct UserProfileMfaBackupCodeListView: View { @@ -94,3 +96,5 @@ struct UserProfileMfaBackupCodeListView: View { ]) .padding() } + +#endif diff --git a/Sources/UI/Components/User/UserProfile/UserProfileMfaSection.swift b/Sources/UI/Components/User/UserProfile/UserProfileMfaSection.swift index 6693b08c..56919bc7 100644 --- a/Sources/UI/Components/User/UserProfile/UserProfileMfaSection.swift +++ b/Sources/UI/Components/User/UserProfile/UserProfileMfaSection.swift @@ -5,6 +5,8 @@ // Created by Mike Pitre on 1/24/24. // +#if canImport(UIKit) + import SwiftUI struct UserProfileMfaSection: View { @@ -196,3 +198,5 @@ struct UserProfileMfaSection: View { UserProfileMfaSection() .padding() } + +#endif diff --git a/Sources/UI/Styles/ClerkDangerButtonStyle.swift b/Sources/UI/Styles/ClerkDangerButtonStyle.swift index aec85dab..b0d2c0ef 100644 --- a/Sources/UI/Styles/ClerkDangerButtonStyle.swift +++ b/Sources/UI/Styles/ClerkDangerButtonStyle.swift @@ -5,6 +5,8 @@ // Created by Mike Pitre on 12/15/23. // +#if canImport(UIKit) + import SwiftUI struct ClerkDangerButtonStyle: ButtonStyle { @@ -44,3 +46,5 @@ struct ClerkDangerButtonStyle: ButtonStyle { } .buttonStyle(ClerkDangerButtonStyle()) } + +#endif diff --git a/Sources/UI/Styles/ClerkPrimaryButtonStyle.swift b/Sources/UI/Styles/ClerkPrimaryButtonStyle.swift index e0c5e1ac..8744dba4 100644 --- a/Sources/UI/Styles/ClerkPrimaryButtonStyle.swift +++ b/Sources/UI/Styles/ClerkPrimaryButtonStyle.swift @@ -5,6 +5,8 @@ // Created by Mike Pitre on 12/15/23. // +#if canImport(UIKit) + import SwiftUI struct ClerkPrimaryButtonStyle: ButtonStyle { @@ -44,3 +46,5 @@ struct ClerkPrimaryButtonStyle: ButtonStyle { } .buttonStyle(ClerkPrimaryButtonStyle()) } + +#endif diff --git a/Sources/UI/Styles/ClerkSecondaryButtonStyle.swift b/Sources/UI/Styles/ClerkSecondaryButtonStyle.swift index 7344d5e8..d22fbf1b 100644 --- a/Sources/UI/Styles/ClerkSecondaryButtonStyle.swift +++ b/Sources/UI/Styles/ClerkSecondaryButtonStyle.swift @@ -5,6 +5,8 @@ // Created by Mike Pitre on 12/15/23. // +#if canImport(UIKit) + import SwiftUI struct ClerkSecondaryButtonStyle: ButtonStyle { @@ -36,3 +38,5 @@ struct ClerkSecondaryButtonStyle: ButtonStyle { } .buttonStyle(ClerkSecondaryButtonStyle()) } + +#endif diff --git a/Sources/UI/ViewModifiers/ClerkBottomBrandingModifier.swift b/Sources/UI/ViewModifiers/ClerkBottomBrandingModifier.swift index c5be8ed5..6860b01f 100644 --- a/Sources/UI/ViewModifiers/ClerkBottomBrandingModifier.swift +++ b/Sources/UI/ViewModifiers/ClerkBottomBrandingModifier.swift @@ -5,6 +5,8 @@ // Created by Mike Pitre on 12/20/23. // +#if canImport(UIKit) + import SwiftUI struct ClerkBottomBrandingModifier: ViewModifier { @@ -40,3 +42,5 @@ extension View { AuthView() .environmentObject(ClerkUIState()) } + +#endif diff --git a/Sources/UI/ViewModifiers/ClerkStandardButtonPaddingModifier.swift b/Sources/UI/ViewModifiers/ClerkStandardButtonPaddingModifier.swift index 78fd3f41..4a642b17 100644 --- a/Sources/UI/ViewModifiers/ClerkStandardButtonPaddingModifier.swift +++ b/Sources/UI/ViewModifiers/ClerkStandardButtonPaddingModifier.swift @@ -5,6 +5,8 @@ // Created by Mike Pitre on 1/17/24. // +#if canImport(UIKit) + import SwiftUI struct ClerkStandardButtonPaddingModifier: ViewModifier { @@ -30,3 +32,5 @@ extension View { } .buttonStyle(ClerkPrimaryButtonStyle()) } + +#endif diff --git a/Sources/UI/ViewModifiers/DismissButtonOverlay.swift b/Sources/UI/ViewModifiers/DismissButtonOverlay.swift index f9fdac63..c9b6bc1e 100644 --- a/Sources/UI/ViewModifiers/DismissButtonOverlay.swift +++ b/Sources/UI/ViewModifiers/DismissButtonOverlay.swift @@ -5,6 +5,8 @@ // Created by Mike Pitre on 11/22/23. // +#if canImport(UIKit) + import Foundation import SwiftUI @@ -38,3 +40,5 @@ extension View { Color(.systemBackground) .dismissButtonOverlay() } + +#endif diff --git a/Sources/UI/ViewModifiers/KeyboardIgnoringBottomViewModifier.swift b/Sources/UI/ViewModifiers/KeyboardIgnoringBottomViewModifier.swift index 3d2517a2..23052461 100644 --- a/Sources/UI/ViewModifiers/KeyboardIgnoringBottomViewModifier.swift +++ b/Sources/UI/ViewModifiers/KeyboardIgnoringBottomViewModifier.swift @@ -5,6 +5,8 @@ // Created by Mike Pitre on 12/20/23. // +#if canImport(UIKit) + import SwiftUI struct KeyboardIgnoringBottomViewModifier: ViewModifier, KeyboardReadable { @@ -57,3 +59,5 @@ extension View { SecuredByClerkView() } } + +#endif