Skip to content

Commit 36fb2dd

Browse files
committed
Fix build error by using @mainactor on individual methods.
1 parent c57d715 commit 36fb2dd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Samples/Swift/DaysUntilBirthday/Shared/Services/GoogleSignInAuthenticator.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import AppKit
2323
#endif
2424

2525
/// An observable class for authenticating via Google.
26-
@MainActor
2726
final class GoogleSignInAuthenticator {
2827
private var authViewModel: AuthenticationViewModel
2928

@@ -38,6 +37,7 @@ final class GoogleSignInAuthenticator {
3837
/// - parameter rootViewController: The `UIViewController` to use during the sign in flow.
3938
/// - returns: The `GIDSignInResult`.
4039
/// - throws: Any error that may arise during the sign in process.
40+
@MainActor
4141
func signIn(with rootViewController: UIViewController) async throws -> GIDSignInResult {
4242
return try await GIDSignIn.sharedInstance.signIn(withPresenting: rootViewController)
4343
}
@@ -48,6 +48,7 @@ final class GoogleSignInAuthenticator {
4848
/// - parameter window: The `NSWindow` to use during the sign in flow.
4949
/// - returns: The `GIDSignInResult`.
5050
/// - throws: Any error that may arise during the sign in process.
51+
@MainActor
5152
func signIn(with window: NSWindow) async throws -> GIDSignInResult {
5253
return try await GIDSignIn.sharedInstance.signIn(withPresenting: window)
5354
}
@@ -60,6 +61,7 @@ final class GoogleSignInAuthenticator {
6061
}
6162

6263
/// Disconnects the previously granted scope and signs the user out.
64+
@MainActor
6365
func disconnect() async throws {
6466
try await GIDSignIn.sharedInstance.disconnect()
6567
}
@@ -69,6 +71,7 @@ final class GoogleSignInAuthenticator {
6971
/// - parameter viewController: The `UIViewController` to use while authorizing the scope.
7072
/// - returns: The `GIDSignInResult`.
7173
/// - throws: Any error that may arise while authorizing the scope.
74+
@MainActor
7275
func addBirthdayReadScope(viewController: UIViewController) async throws -> GIDSignInResult {
7376
guard let currentUser = GIDSignIn.sharedInstance.currentUser else {
7477
fatalError("No currentUser!")
@@ -85,6 +88,7 @@ final class GoogleSignInAuthenticator {
8588
/// - parameter window: The `NSWindow` to use while authorizing the scope.
8689
/// - returns: The `GIDSignInResult`.
8790
/// - throws: Any error that may arise while authorizing the scope.
91+
@MainActor
8892
func addBirthdayReadScope(window: NSWindow) async throws -> GIDSignInResult {
8993
guard let currentUser = GIDSignIn.sharedInstance.currentUser else {
9094
fatalError("No currentUser!")

0 commit comments

Comments
 (0)