GAppAuth icon indicating copy to clipboard operation
GAppAuth copied to clipboard

Using Authorize from SwiftUI view

Open infinitetrooper opened this issue 4 years ago • 3 comments

Hello, Firstly, Thanks @elsesiy for the brilliant work.

Secondly, Is there any way to call the GAppAuth.shared.authorize from a SwiftUI view, The current implementation requires us to pass a UIViewController for presentingViewController but, I'm building an app in SwiftUI and would love to handle the auth without adding an extra view controller just for a login button.

Also, any plans to release a new version to support the updated GTMAppAuth and AppAuth releases?

Thanks Again!

infinitetrooper avatar Dec 04 '20 18:12 infinitetrooper

@infinitetrooper Thank you for reaching out! I understand the inconvenience and would love to support SwiftUI natively. Unfortunately I'm not up-to-date with the latest Apple developments anymore and don't think I'll find the time to dig into that very soon. Feel free to submit a PR! I can look into updating the dependencies which should be quick (I hope)

elsesiy avatar Dec 10 '20 22:12 elsesiy

Thanks @elsesiy, I will definitely look to create a PR for SwiftUI if I end up figuring out how to implement the same functionality as is currently supported. Will keep an eye out for dependencies update.

infinitetrooper avatar Dec 17 '20 15:12 infinitetrooper

Secondly, Is there any way to call the GAppAuth.shared.authorize from a SwiftUI view, The current implementation requires us to pass a UIViewController for presentingViewController but, I'm building an app in SwiftUI and would love to handle the auth without adding an extra view controller just for a login button.

I'm not familiar with UIkit so how would you do it with the adding an extra UI view controller way? I'm trying to make a multiplatform app for iOS and macOS so do I make separate things for UIViewController and NSViewController?

I am thinking off showing a sheet that has a sign in with google button

Tony1324 avatar Apr 19 '21 11:04 Tony1324