From 65ee853a6f8cf07eba79d45c2baf4f3b915a2ff4 Mon Sep 17 00:00:00 2001 From: W <115107835+w-goog@users.noreply.github.com> Date: Mon, 11 Aug 2025 16:29:33 -0700 Subject: [PATCH 1/9] Enable Swift 6 when available --- GoogleSignInSwift/Sources/GoogleSignInButtonViewModel.swift | 2 +- Package.swift | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/GoogleSignInSwift/Sources/GoogleSignInButtonViewModel.swift b/GoogleSignInSwift/Sources/GoogleSignInButtonViewModel.swift index 0d9a1916..df875b12 100644 --- a/GoogleSignInSwift/Sources/GoogleSignInButtonViewModel.swift +++ b/GoogleSignInSwift/Sources/GoogleSignInButtonViewModel.swift @@ -21,7 +21,7 @@ import Combine /// A view model for the SwiftUI sign-in button publishing changes for the /// button scheme, style, and state. @available(iOS 13.0, macOS 10.15, *) -public class GoogleSignInButtonViewModel: ObservableObject { +@MainActor public class GoogleSignInButtonViewModel: ObservableObject { @Published public var scheme: GoogleSignInButtonColorScheme @Published public var style: GoogleSignInButtonStyle @Published public var state: GoogleSignInButtonState diff --git a/Package.swift b/Package.swift index 5619a2c3..89e83dcf 100644 --- a/Package.swift +++ b/Package.swift @@ -129,5 +129,6 @@ let package = Package( dependencies: ["GoogleSignInSwift"], path: "GoogleSignInSwift/Tests/Unit" ) - ] + ], + swiftLanguageVersions: [.version("6"), .v5] ) From 634d860ab52d52f5a56e94ca140d2fafc99761d9 Mon Sep 17 00:00:00 2001 From: W <115107835+w-goog@users.noreply.github.com> Date: Mon, 11 Aug 2025 16:33:48 -0700 Subject: [PATCH 2/9] Test commit for local package dependency --- GoogleSignInSwift/Sources/GoogleSignInButtonStrings.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GoogleSignInSwift/Sources/GoogleSignInButtonStrings.swift b/GoogleSignInSwift/Sources/GoogleSignInButtonStrings.swift index e31394ee..a7f3bdd8 100644 --- a/GoogleSignInSwift/Sources/GoogleSignInButtonStrings.swift +++ b/GoogleSignInSwift/Sources/GoogleSignInButtonStrings.swift @@ -23,7 +23,7 @@ import Foundation struct GoogleSignInButtonString { /// Button text used as both key in localized strings files and default value /// for the standard button. - private let standardButtonText = "Sign in" + private let standardButtonText = "🎹 COMPUTER LOVE 👾" /// Button text used as both key in localized strings files and default value /// for the wide button. private let wideButtonText = "Sign in with Google" From 9fb1930ba845dce33742c88a03d45120c29440e5 Mon Sep 17 00:00:00 2001 From: W <115107835+w-goog@users.noreply.github.com> Date: Mon, 11 Aug 2025 16:40:17 -0700 Subject: [PATCH 3/9] Revert "Test commit for local package dependency" This reverts commit 0e3eb5dae021d3cf2ba09a8d29e1dcfbab089ebe. --- GoogleSignInSwift/Sources/GoogleSignInButtonStrings.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GoogleSignInSwift/Sources/GoogleSignInButtonStrings.swift b/GoogleSignInSwift/Sources/GoogleSignInButtonStrings.swift index a7f3bdd8..e31394ee 100644 --- a/GoogleSignInSwift/Sources/GoogleSignInButtonStrings.swift +++ b/GoogleSignInSwift/Sources/GoogleSignInButtonStrings.swift @@ -23,7 +23,7 @@ import Foundation struct GoogleSignInButtonString { /// Button text used as both key in localized strings files and default value /// for the standard button. - private let standardButtonText = "🎹 COMPUTER LOVE 👾" + private let standardButtonText = "Sign in" /// Button text used as both key in localized strings files and default value /// for the wide button. private let wideButtonText = "Sign in with Google" From f49c52f4fcbeafbcbbf944525902a172f39f9df9 Mon Sep 17 00:00:00 2001 From: W <115107835+w-goog@users.noreply.github.com> Date: Mon, 11 Aug 2025 16:45:26 -0700 Subject: [PATCH 4/9] Try to compile for Swift 5 w/out the @MainActor on the view model. --- GoogleSignInSwift/Sources/GoogleSignInButtonViewModel.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GoogleSignInSwift/Sources/GoogleSignInButtonViewModel.swift b/GoogleSignInSwift/Sources/GoogleSignInButtonViewModel.swift index df875b12..0d9a1916 100644 --- a/GoogleSignInSwift/Sources/GoogleSignInButtonViewModel.swift +++ b/GoogleSignInSwift/Sources/GoogleSignInButtonViewModel.swift @@ -21,7 +21,7 @@ import Combine /// A view model for the SwiftUI sign-in button publishing changes for the /// button scheme, style, and state. @available(iOS 13.0, macOS 10.15, *) -@MainActor public class GoogleSignInButtonViewModel: ObservableObject { +public class GoogleSignInButtonViewModel: ObservableObject { @Published public var scheme: GoogleSignInButtonColorScheme @Published public var style: GoogleSignInButtonStyle @Published public var state: GoogleSignInButtonState From 0764f978d6c9162580453283f0680506219b4300 Mon Sep 17 00:00:00 2001 From: W <115107835+w-goog@users.noreply.github.com> Date: Tue, 12 Aug 2025 16:42:36 -0700 Subject: [PATCH 5/9] Force v5 language for testing --- Package.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index 89e83dcf..d420545c 100644 --- a/Package.swift +++ b/Package.swift @@ -130,5 +130,5 @@ let package = Package( path: "GoogleSignInSwift/Tests/Unit" ) ], - swiftLanguageVersions: [.version("6"), .v5] + swiftLanguageVersions: [.v5] ) From f32ad4cc79e28f593a9079eade38c6cd79b2136a Mon Sep 17 00:00:00 2001 From: W <115107835+w-goog@users.noreply.github.com> Date: Tue, 12 Aug 2025 16:46:02 -0700 Subject: [PATCH 6/9] Mark style methods as preconcurrency --- GoogleSignInSwift/Sources/GoogleSignInButtonStyling.swift | 2 +- GoogleSignInSwift/Sources/GoogleSignInButtonViewModel.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/GoogleSignInSwift/Sources/GoogleSignInButtonStyling.swift b/GoogleSignInSwift/Sources/GoogleSignInButtonStyling.swift index 344b2201..5bb8b62e 100644 --- a/GoogleSignInSwift/Sources/GoogleSignInButtonStyling.swift +++ b/GoogleSignInSwift/Sources/GoogleSignInButtonStyling.swift @@ -257,7 +257,7 @@ extension GoogleSignInButtonStyle { // MARK: - Button Style @available(iOS 13.0, macOS 10.15, *) -struct SwiftUIButtonStyle: ButtonStyle { +@preconcurrency struct SwiftUIButtonStyle: ButtonStyle { let style: GoogleSignInButtonStyle let state: GoogleSignInButtonState let scheme: GoogleSignInButtonColorScheme diff --git a/GoogleSignInSwift/Sources/GoogleSignInButtonViewModel.swift b/GoogleSignInSwift/Sources/GoogleSignInButtonViewModel.swift index 0d9a1916..3ef8922e 100644 --- a/GoogleSignInSwift/Sources/GoogleSignInButtonViewModel.swift +++ b/GoogleSignInSwift/Sources/GoogleSignInButtonViewModel.swift @@ -21,7 +21,7 @@ import Combine /// A view model for the SwiftUI sign-in button publishing changes for the /// button scheme, style, and state. @available(iOS 13.0, macOS 10.15, *) -public class GoogleSignInButtonViewModel: ObservableObject { +@preconcurrency public class GoogleSignInButtonViewModel: ObservableObject { @Published public var scheme: GoogleSignInButtonColorScheme @Published public var style: GoogleSignInButtonStyle @Published public var state: GoogleSignInButtonState From e409037626785798d687da2fb5d01d3f8335771f Mon Sep 17 00:00:00 2001 From: W <115107835+w-goog@users.noreply.github.com> Date: Tue, 12 Aug 2025 16:47:45 -0700 Subject: [PATCH 7/9] Revert "Mark style methods as preconcurrency" This reverts commit 98eb737a5f7b012a0d8e66d342e1138ac13c4afa. --- GoogleSignInSwift/Sources/GoogleSignInButtonStyling.swift | 2 +- GoogleSignInSwift/Sources/GoogleSignInButtonViewModel.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/GoogleSignInSwift/Sources/GoogleSignInButtonStyling.swift b/GoogleSignInSwift/Sources/GoogleSignInButtonStyling.swift index 5bb8b62e..344b2201 100644 --- a/GoogleSignInSwift/Sources/GoogleSignInButtonStyling.swift +++ b/GoogleSignInSwift/Sources/GoogleSignInButtonStyling.swift @@ -257,7 +257,7 @@ extension GoogleSignInButtonStyle { // MARK: - Button Style @available(iOS 13.0, macOS 10.15, *) -@preconcurrency struct SwiftUIButtonStyle: ButtonStyle { +struct SwiftUIButtonStyle: ButtonStyle { let style: GoogleSignInButtonStyle let state: GoogleSignInButtonState let scheme: GoogleSignInButtonColorScheme diff --git a/GoogleSignInSwift/Sources/GoogleSignInButtonViewModel.swift b/GoogleSignInSwift/Sources/GoogleSignInButtonViewModel.swift index 3ef8922e..0d9a1916 100644 --- a/GoogleSignInSwift/Sources/GoogleSignInButtonViewModel.swift +++ b/GoogleSignInSwift/Sources/GoogleSignInButtonViewModel.swift @@ -21,7 +21,7 @@ import Combine /// A view model for the SwiftUI sign-in button publishing changes for the /// button scheme, style, and state. @available(iOS 13.0, macOS 10.15, *) -@preconcurrency public class GoogleSignInButtonViewModel: ObservableObject { +public class GoogleSignInButtonViewModel: ObservableObject { @Published public var scheme: GoogleSignInButtonColorScheme @Published public var style: GoogleSignInButtonStyle @Published public var state: GoogleSignInButtonState From f4b293538dff920ae16d2a17997f459e026ec1ef Mon Sep 17 00:00:00 2001 From: W <115107835+w-goog@users.noreply.github.com> Date: Tue, 12 Aug 2025 16:47:56 -0700 Subject: [PATCH 8/9] Revert "Force v5 language for testing" This reverts commit aff4afce7cb0e1e42edfc64739bb3041a875b33b. --- Package.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index d420545c..89e83dcf 100644 --- a/Package.swift +++ b/Package.swift @@ -130,5 +130,5 @@ let package = Package( path: "GoogleSignInSwift/Tests/Unit" ) ], - swiftLanguageVersions: [.v5] + swiftLanguageVersions: [.version("6"), .v5] ) From 760d39b0f5f66d46d7ad31f7a6d82189b8b68bdc Mon Sep 17 00:00:00 2001 From: W <115107835+w-goog@users.noreply.github.com> Date: Wed, 20 Aug 2025 12:56:41 -0700 Subject: [PATCH 9/9] Update swift-tools to 6.0 by default, adding Package@swift-5.5.swift to support older versions. --- Package.swift | 5 +- Package@swift-5.5.swift | 133 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 135 insertions(+), 3 deletions(-) create mode 100644 Package@swift-5.5.swift diff --git a/Package.swift b/Package.swift index 89e83dcf..8fa14f15 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.5 +// swift-tools-version:6.0 // The swift-tools-version declares the minimum version of Swift required to build this package. // Copyright 2021 Google LLC @@ -129,6 +129,5 @@ let package = Package( dependencies: ["GoogleSignInSwift"], path: "GoogleSignInSwift/Tests/Unit" ) - ], - swiftLanguageVersions: [.version("6"), .v5] + ] ) diff --git a/Package@swift-5.5.swift b/Package@swift-5.5.swift new file mode 100644 index 00000000..5619a2c3 --- /dev/null +++ b/Package@swift-5.5.swift @@ -0,0 +1,133 @@ +// swift-tools-version:5.5 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import PackageDescription + +let googleSignInVersion = "9.0.0" + +let package = Package( + name: "GoogleSignIn", + defaultLocalization: "en", + platforms: [ + .macOS(.v10_15), + .iOS(.v12) + ], + products: [ + .library( + name: "GoogleSignIn", + targets: [ + "GoogleSignIn", + ] + ), + .library( + name: "GoogleSignInSwift", + targets: [ + "GoogleSignInSwift", + ] + ), + ], + dependencies: [ + .package( + name: "AppAuth", + url: "https://github.com/openid/AppAuth-iOS.git", + from: "2.0.0"), + .package( + name: "AppCheck", + url: "https://github.com/google/app-check.git", + from: "11.0.0"), + .package( + name: "GTMAppAuth", + url: "https://github.com/google/GTMAppAuth.git", + from: "5.0.0"), + .package( + name: "GTMSessionFetcher", + url: "https://github.com/google/gtm-session-fetcher.git", + from: "3.3.0"), + .package( + name: "OCMock", + url: "https://github.com/firebase/ocmock.git", + .revision("7291762d3551c5c7e31c49cce40a0e391a52e889")), + .package( + name: "GoogleUtilities", + url: "https://github.com/google/GoogleUtilities.git", + from: "8.0.0"), + ], + targets: [ + .target( + name: "GoogleSignIn", + dependencies: [ + .product(name: "AppAuth", package: "AppAuth"), + .product(name: "AppAuthCore", package: "AppAuth"), + .product(name: "AppCheckCore", package: "AppCheck"), + .product(name: "GTMAppAuth", package: "GTMAppAuth"), + .product(name: "GTMSessionFetcherCore", package: "GTMSessionFetcher"), + ], + path: "GoogleSignIn/Sources", + resources: [ + .process("Resources"), + .process("Strings"), + ], + publicHeadersPath: "Public", + cSettings: [ + .headerSearchPath("../../"), + .define("GID_SDK_VERSION", to: googleSignInVersion), + ], + linkerSettings: [ + .linkedFramework("CoreGraphics"), + .linkedFramework("CoreText"), + .linkedFramework("Foundation"), + .linkedFramework("LocalAuthentication"), + .linkedFramework("Security"), + .linkedFramework("AppKit", .when(platforms: [.macOS])), + .linkedFramework("UIKit", .when(platforms: [.iOS])), + ] + ), + .target( + name: "GoogleSignInSwift", + dependencies: [ + "GoogleSignIn", + ], + path: "GoogleSignInSwift/Sources", + resources: [ + .copy("Resources/PrivacyInfo.xcprivacy") + ] + ), + .testTarget( + name: "GoogleSignIn-UnitTests", + dependencies: [ + "GoogleSignIn", + "OCMock", + .product(name: "AppAuth", package: "AppAuth"), + .product(name: "AppCheckCore", package: "AppCheck"), + .product(name: "GTMAppAuth", package: "GTMAppAuth"), + .product(name: "GTMSessionFetcherCore", package: "GTMSessionFetcher"), + .product(name: "GULMethodSwizzler", package: "GoogleUtilities"), + .product(name: "GULSwizzlerTestHelpers", package: "GoogleUtilities"), + ], + path: "GoogleSignIn/Tests/Unit", + cSettings: [ + .headerSearchPath("../../../"), + .define("GID_SDK_VERSION", to: googleSignInVersion), + ] + ), + .testTarget( + name: "GoogleSignInSwift-UnitTests", + dependencies: ["GoogleSignInSwift"], + path: "GoogleSignInSwift/Tests/Unit" + ) + ] +)