diff --git a/README.md b/README.md
index 038fc06..8bfbbbd 100644
--- a/README.md
+++ b/README.md
@@ -4,10 +4,12 @@ This repo provide you with the complete setup of Firebase google sign in with Sw
## What will you be building
You will be building the functionality to login use Goole. Below is the screen.
+
+
+
+
+
-
-
-
#### Setup for Completed project
If you are planning to try out my completed project, do follow these additional steps before running it.
diff --git a/SignInUsingGoogle/SignInUsingGoogle.xcodeproj/project.pbxproj b/SignInUsingGoogle/SignInUsingGoogle.xcodeproj/project.pbxproj
index 10064a3..e3d1653 100644
--- a/SignInUsingGoogle/SignInUsingGoogle.xcodeproj/project.pbxproj
+++ b/SignInUsingGoogle/SignInUsingGoogle.xcodeproj/project.pbxproj
@@ -16,7 +16,12 @@
203073DF282D0205006F7F26 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 203073DE282D0205006F7F26 /* Preview Assets.xcassets */; };
203073E7282D023E006F7F26 /* GoogleSiginBtn.swift in Sources */ = {isa = PBXBuildFile; fileRef = 203073E6282D023E006F7F26 /* GoogleSiginBtn.swift */; };
203073EA282D02C7006F7F26 /* Home.swift in Sources */ = {isa = PBXBuildFile; fileRef = 203073E9282D02C7006F7F26 /* Home.swift */; };
- 20CE7107282D052000817D34 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 20CE7106282D052000817D34 /* GoogleService-Info.plist */; };
+ 20CE70FF282D047900817D34 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20CE70FE282D047900817D34 /* AppDelegate.swift */; };
+ 20CE7102282D04D100817D34 /* FirebaseAuth in Frameworks */ = {isa = PBXBuildFile; productRef = 20CE7101282D04D100817D34 /* FirebaseAuth */; };
+ 20CE7105282D04F100817D34 /* GoogleSignIn in Frameworks */ = {isa = PBXBuildFile; productRef = 20CE7104282D04F100817D34 /* GoogleSignIn */; };
+ 20CE7109282D05A900817D34 /* +View.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20CE7108282D05A900817D34 /* +View.swift */; };
+ 20CE710C282D072D00817D34 /* FirebAuth.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20CE710B282D072D00817D34 /* FirebAuth.swift */; };
+ FB1306932C9115D4005910E4 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = FB1306922C9115D4005910E4 /* GoogleService-Info.plist */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -30,8 +35,11 @@
203073DE282D0205006F7F26 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; };
203073E6282D023E006F7F26 /* GoogleSiginBtn.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GoogleSiginBtn.swift; sourceTree = ""; };
203073E9282D02C7006F7F26 /* Home.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Home.swift; sourceTree = ""; };
- 20CE7106282D052000817D34 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; };
+ 20CE70FE282D047900817D34 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
+ 20CE7108282D05A900817D34 /* +View.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "+View.swift"; sourceTree = ""; };
20CE710A282D05FE00817D34 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; };
+ 20CE710B282D072D00817D34 /* FirebAuth.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FirebAuth.swift; sourceTree = ""; };
+ FB1306922C9115D4005910E4 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "../../../../Downloads/GoogleService-Info.plist"; sourceTree = ""; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -39,6 +47,8 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ 20CE7102282D04D100817D34 /* FirebaseAuth in Frameworks */,
+ 20CE7105282D04F100817D34 /* GoogleSignIn in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -64,12 +74,13 @@
203073D6282D0204006F7F26 /* SignInUsingGoogle */ = {
isa = PBXGroup;
children = (
+ FB1306922C9115D4005910E4 /* GoogleService-Info.plist */,
20CE710A282D05FE00817D34 /* Info.plist */,
+ 20CE70FD282D046200817D34 /* Helper */,
203073E8282D025F006F7F26 /* Screen */,
203073E5282D020E006F7F26 /* View */,
203073D7282D0204006F7F26 /* SignInUsingGoogleApp.swift */,
203073DB282D0205006F7F26 /* Assets.xcassets */,
- 20CE7106282D052000817D34 /* GoogleService-Info.plist */,
203073DD282D0205006F7F26 /* Preview Content */,
);
path = SignInUsingGoogle;
@@ -103,6 +114,16 @@
path = Screen;
sourceTree = "";
};
+ 20CE70FD282D046200817D34 /* Helper */ = {
+ isa = PBXGroup;
+ children = (
+ 20CE70FE282D047900817D34 /* AppDelegate.swift */,
+ 20CE7108282D05A900817D34 /* +View.swift */,
+ 20CE710B282D072D00817D34 /* FirebAuth.swift */,
+ );
+ path = Helper;
+ sourceTree = "";
+ };
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -120,6 +141,8 @@
);
name = SignInUsingGoogle;
packageProductDependencies = (
+ 20CE7101282D04D100817D34 /* FirebaseAuth */,
+ 20CE7104282D04F100817D34 /* GoogleSignIn */,
);
productName = SignInUsingGoogle;
productReference = 203073D4282D0204006F7F26 /* SignInUsingGoogle.app */;
@@ -150,6 +173,8 @@
);
mainGroup = 203073CB282D0204006F7F26;
packageReferences = (
+ 20CE7100282D04D100817D34 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */,
+ 20CE7103282D04F100817D34 /* XCRemoteSwiftPackageReference "GoogleSignIn-iOS" */,
);
productRefGroup = 203073D5282D0204006F7F26 /* Products */;
projectDirPath = "";
@@ -166,8 +191,8 @@
buildActionMask = 2147483647;
files = (
203073DF282D0205006F7F26 /* Preview Assets.xcassets in Resources */,
+ FB1306932C9115D4005910E4 /* GoogleService-Info.plist in Resources */,
203073DC282D0205006F7F26 /* Assets.xcassets in Resources */,
- 20CE7107282D052000817D34 /* GoogleService-Info.plist in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -178,7 +203,10 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
+ 20CE710C282D072D00817D34 /* FirebAuth.swift in Sources */,
+ 20CE70FF282D047900817D34 /* AppDelegate.swift in Sources */,
203073DA282D0204006F7F26 /* LoginScreen.swift in Sources */,
+ 20CE7109282D05A900817D34 /* +View.swift in Sources */,
2000B6A028C4B83F0090697A /* CustomButton.swift in Sources */,
203073D8282D0204006F7F26 /* SignInUsingGoogleApp.swift in Sources */,
203073EA282D02C7006F7F26 /* Home.swift in Sources */,
@@ -387,6 +415,38 @@
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
+
+/* Begin XCRemoteSwiftPackageReference section */
+ 20CE7100282D04D100817D34 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */ = {
+ isa = XCRemoteSwiftPackageReference;
+ repositoryURL = "https://github.com/firebase/firebase-ios-sdk";
+ requirement = {
+ kind = upToNextMajorVersion;
+ minimumVersion = 9.0.0;
+ };
+ };
+ 20CE7103282D04F100817D34 /* XCRemoteSwiftPackageReference "GoogleSignIn-iOS" */ = {
+ isa = XCRemoteSwiftPackageReference;
+ repositoryURL = "https://github.com/google/GoogleSignIn-iOS";
+ requirement = {
+ kind = upToNextMajorVersion;
+ minimumVersion = 6.0.0;
+ };
+ };
+/* End XCRemoteSwiftPackageReference section */
+
+/* Begin XCSwiftPackageProductDependency section */
+ 20CE7101282D04D100817D34 /* FirebaseAuth */ = {
+ isa = XCSwiftPackageProductDependency;
+ package = 20CE7100282D04D100817D34 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */;
+ productName = FirebaseAuth;
+ };
+ 20CE7104282D04F100817D34 /* GoogleSignIn */ = {
+ isa = XCSwiftPackageProductDependency;
+ package = 20CE7103282D04F100817D34 /* XCRemoteSwiftPackageReference "GoogleSignIn-iOS" */;
+ productName = GoogleSignIn;
+ };
+/* End XCSwiftPackageProductDependency section */
};
rootObject = 203073CC282D0204006F7F26 /* Project object */;
}
diff --git a/SignInUsingGoogle/SignInUsingGoogle.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/SignInUsingGoogle/SignInUsingGoogle.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
new file mode 100644
index 0000000..ea7cb86
--- /dev/null
+++ b/SignInUsingGoogle/SignInUsingGoogle.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
@@ -0,0 +1,141 @@
+{
+ "originHash" : "7ed78cec4688813732ed048994a6c24c5c081e333197fce4007040cea0ee7d0c",
+ "pins" : [
+ {
+ "identity" : "abseil-cpp-swiftpm",
+ "kind" : "remoteSourceControl",
+ "location" : "https://github.com/firebase/abseil-cpp-SwiftPM.git",
+ "state" : {
+ "revision" : "583de9bd60f66b40e78d08599cc92036c2e7e4e1",
+ "version" : "0.20220203.2"
+ }
+ },
+ {
+ "identity" : "appauth-ios",
+ "kind" : "remoteSourceControl",
+ "location" : "https://github.com/openid/AppAuth-iOS.git",
+ "state" : {
+ "revision" : "c89ed571ae140f8eb1142735e6e23d7bb8c34cb2",
+ "version" : "1.7.5"
+ }
+ },
+ {
+ "identity" : "boringssl-swiftpm",
+ "kind" : "remoteSourceControl",
+ "location" : "https://github.com/firebase/boringssl-SwiftPM.git",
+ "state" : {
+ "revision" : "dd3eda2b05a3f459fc3073695ad1b28659066eab",
+ "version" : "0.9.1"
+ }
+ },
+ {
+ "identity" : "firebase-ios-sdk",
+ "kind" : "remoteSourceControl",
+ "location" : "https://github.com/firebase/firebase-ios-sdk",
+ "state" : {
+ "revision" : "7e80c25b51c2ffa238879b07fbfc5baa54bb3050",
+ "version" : "9.6.0"
+ }
+ },
+ {
+ "identity" : "googleappmeasurement",
+ "kind" : "remoteSourceControl",
+ "location" : "https://github.com/google/GoogleAppMeasurement.git",
+ "state" : {
+ "revision" : "c1cfde8067668027b23a42c29d11c246152fe046",
+ "version" : "9.6.0"
+ }
+ },
+ {
+ "identity" : "googledatatransport",
+ "kind" : "remoteSourceControl",
+ "location" : "https://github.com/google/GoogleDataTransport.git",
+ "state" : {
+ "revision" : "a637d318ae7ae246b02d7305121275bc75ed5565",
+ "version" : "9.4.0"
+ }
+ },
+ {
+ "identity" : "googlesignin-ios",
+ "kind" : "remoteSourceControl",
+ "location" : "https://github.com/google/GoogleSignIn-iOS.git",
+ "state" : {
+ "revision" : "9c9b36af86a4dd3da16048a36cf37351e63ccfe1",
+ "version" : "6.2.4"
+ }
+ },
+ {
+ "identity" : "googleutilities",
+ "kind" : "remoteSourceControl",
+ "location" : "https://github.com/google/GoogleUtilities.git",
+ "state" : {
+ "revision" : "57a1d307f42df690fdef2637f3e5b776da02aad6",
+ "version" : "7.13.3"
+ }
+ },
+ {
+ "identity" : "grpc-ios",
+ "kind" : "remoteSourceControl",
+ "location" : "https://github.com/grpc/grpc-ios.git",
+ "state" : {
+ "revision" : "8440b914756e0d26d4f4d054a1c1581daedfc5b6",
+ "version" : "1.44.3-grpc"
+ }
+ },
+ {
+ "identity" : "gtm-session-fetcher",
+ "kind" : "remoteSourceControl",
+ "location" : "https://github.com/google/gtm-session-fetcher.git",
+ "state" : {
+ "revision" : "5ccda3981422a84186387dbb763ba739178b529c",
+ "version" : "2.3.0"
+ }
+ },
+ {
+ "identity" : "gtmappauth",
+ "kind" : "remoteSourceControl",
+ "location" : "https://github.com/google/GTMAppAuth.git",
+ "state" : {
+ "revision" : "6dee0cde8a1b223737a5159e55e6b4ec16bbbdd9",
+ "version" : "1.3.1"
+ }
+ },
+ {
+ "identity" : "leveldb",
+ "kind" : "remoteSourceControl",
+ "location" : "https://github.com/firebase/leveldb.git",
+ "state" : {
+ "revision" : "0706abcc6b0bd9cedfbb015ba840e4a780b5159b",
+ "version" : "1.22.2"
+ }
+ },
+ {
+ "identity" : "nanopb",
+ "kind" : "remoteSourceControl",
+ "location" : "https://github.com/firebase/nanopb.git",
+ "state" : {
+ "revision" : "819d0a2173aff699fb8c364b6fb906f7cdb1a692",
+ "version" : "2.30909.0"
+ }
+ },
+ {
+ "identity" : "promises",
+ "kind" : "remoteSourceControl",
+ "location" : "https://github.com/google/promises.git",
+ "state" : {
+ "revision" : "540318ecedd63d883069ae7f1ed811a2df00b6ac",
+ "version" : "2.4.0"
+ }
+ },
+ {
+ "identity" : "swift-protobuf",
+ "kind" : "remoteSourceControl",
+ "location" : "https://github.com/apple/swift-protobuf.git",
+ "state" : {
+ "revision" : "e1499bc69b9040b29184f7f2996f7bab467c1639",
+ "version" : "1.19.0"
+ }
+ }
+ ],
+ "version" : 3
+}
diff --git a/SignInUsingGoogle/SignInUsingGoogle.xcodeproj/project.xcworkspace/xcuserdata/alumno.xcuserdatad/UserInterfaceState.xcuserstate b/SignInUsingGoogle/SignInUsingGoogle.xcodeproj/project.xcworkspace/xcuserdata/alumno.xcuserdatad/UserInterfaceState.xcuserstate
new file mode 100644
index 0000000..dcac9bc
Binary files /dev/null and b/SignInUsingGoogle/SignInUsingGoogle.xcodeproj/project.xcworkspace/xcuserdata/alumno.xcuserdatad/UserInterfaceState.xcuserstate differ
diff --git a/SignInUsingGoogle/SignInUsingGoogle.xcodeproj/project.xcworkspace/xcuserdata/sweekwang.xcuserdatad/UserInterfaceState.xcuserstate b/SignInUsingGoogle/SignInUsingGoogle.xcodeproj/project.xcworkspace/xcuserdata/sweekwang.xcuserdatad/UserInterfaceState.xcuserstate
index 929391e..da9373f 100644
Binary files a/SignInUsingGoogle/SignInUsingGoogle.xcodeproj/project.xcworkspace/xcuserdata/sweekwang.xcuserdatad/UserInterfaceState.xcuserstate and b/SignInUsingGoogle/SignInUsingGoogle.xcodeproj/project.xcworkspace/xcuserdata/sweekwang.xcuserdatad/UserInterfaceState.xcuserstate differ
diff --git a/SignInUsingGoogle/SignInUsingGoogle.xcodeproj/xcuserdata/alumno.xcuserdatad/xcschemes/xcschememanagement.plist b/SignInUsingGoogle/SignInUsingGoogle.xcodeproj/xcuserdata/alumno.xcuserdatad/xcschemes/xcschememanagement.plist
new file mode 100644
index 0000000..a57bda0
--- /dev/null
+++ b/SignInUsingGoogle/SignInUsingGoogle.xcodeproj/xcuserdata/alumno.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -0,0 +1,35 @@
+
+
+
+
+ SchemeUserState
+
+ Promises (Playground) 1.xcscheme
+
+ isShown
+
+ orderHint
+ 2
+
+ Promises (Playground) 2.xcscheme
+
+ isShown
+
+ orderHint
+ 3
+
+ Promises (Playground).xcscheme
+
+ isShown
+
+ orderHint
+ 0
+
+ SignInUsingGoogle.xcscheme_^#shared#^_
+
+ orderHint
+ 0
+
+
+
+
diff --git a/SignInUsingGoogle/SignInUsingGoogle/Assets.xcassets/LogoTec.imageset/Contents.json b/SignInUsingGoogle/SignInUsingGoogle/Assets.xcassets/LogoTec.imageset/Contents.json
new file mode 100644
index 0000000..cc3847c
--- /dev/null
+++ b/SignInUsingGoogle/SignInUsingGoogle/Assets.xcassets/LogoTec.imageset/Contents.json
@@ -0,0 +1,21 @@
+{
+ "images" : [
+ {
+ "filename" : "LogoTec.png",
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/SignInUsingGoogle/SignInUsingGoogle/Assets.xcassets/LogoTec.imageset/LogoTec.png b/SignInUsingGoogle/SignInUsingGoogle/Assets.xcassets/LogoTec.imageset/LogoTec.png
new file mode 100644
index 0000000..7b42e39
Binary files /dev/null and b/SignInUsingGoogle/SignInUsingGoogle/Assets.xcassets/LogoTec.imageset/LogoTec.png differ
diff --git a/SignInUsingGoogle/SignInUsingGoogle/Helper/+View.swift b/SignInUsingGoogle/SignInUsingGoogle/Helper/+View.swift
new file mode 100644
index 0000000..2ef7e72
--- /dev/null
+++ b/SignInUsingGoogle/SignInUsingGoogle/Helper/+View.swift
@@ -0,0 +1,25 @@
+//
+// +View.swift
+// SignInUsingGoogle
+//
+// Created by Alumno on 9/09/24.
+//
+
+import Foundation
+
+import SwiftUI
+
+extension View {
+ func getRootViewController() -> UIViewController {
+ guard let screen = UIApplication.shared.connectedScenes.first as? UIWindowScene else {
+ return .init()
+ }
+
+ guard let root = screen.windows.first?.rootViewController else {
+ return .init()
+ }
+
+
+ return root
+ }
+}
diff --git a/SignInUsingGoogle/SignInUsingGoogle/Helper/AppDelegate.swift b/SignInUsingGoogle/SignInUsingGoogle/Helper/AppDelegate.swift
new file mode 100644
index 0000000..6f47012
--- /dev/null
+++ b/SignInUsingGoogle/SignInUsingGoogle/Helper/AppDelegate.swift
@@ -0,0 +1,25 @@
+//
+// AppDelegate.swift
+// SignInUsingGoogle
+//
+// Created by Alumno on 9/09/24.
+//
+
+import UIKit
+import Firebase
+import GoogleSignIn
+
+class AppDelegate: NSObject, UIApplicationDelegate {
+ func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
+ // Initializetion code for firebase
+ FirebaseApp.configure()
+ return true
+ }
+
+ @available(iOS 9.0, *)
+ func application(_ application: UIApplication, open url: URL,
+ options: [UIApplication.OpenURLOptionsKey: Any])
+ -> Bool {
+ return GIDSignIn.sharedInstance.handle(url)
+ }
+}
diff --git a/SignInUsingGoogle/SignInUsingGoogle/Helper/FirebAuth.swift b/SignInUsingGoogle/SignInUsingGoogle/Helper/FirebAuth.swift
new file mode 100644
index 0000000..b01c713
--- /dev/null
+++ b/SignInUsingGoogle/SignInUsingGoogle/Helper/FirebAuth.swift
@@ -0,0 +1,53 @@
+//
+// FirebAuth.swift
+// SignInUsingGoogle
+//
+// Created by Alumno on 9/09/24.
+//
+
+import Foundation
+import FirebaseAuth
+import GoogleSignIn
+import Firebase
+
+struct FirebAuth {
+ static let share = FirebAuth()
+
+ private init() {}
+
+ func signinWithGoogle(presenting: UIViewController,
+ completion: @escaping (Error?) -> Void) {
+ guard let clientID = FirebaseApp.app()?.options.clientID else { return }
+
+ // Create Google Sign In configuration object.
+ let config = GIDConfiguration(clientID: clientID)
+
+ // Start the sign in flow!
+ GIDSignIn.sharedInstance.signIn(with: config, presenting: presenting) {user, error in
+
+ if let error = error {
+ completion(error)
+ return
+ }
+
+ guard
+ let authentication = user?.authentication,
+ let idToken = authentication.idToken
+ else {
+ return
+ }
+
+ let credential = GoogleAuthProvider.credential(withIDToken: idToken,
+ accessToken: authentication.accessToken)
+
+ Auth.auth().signIn(with: credential) { result, error in
+ guard error == nil else {
+ completion(error)
+ return
+ }
+ print("SIGN IN")
+ UserDefaults.standard.set(true, forKey: "signIn") // When this change to true, it will go to the home screen
+ }
+ }
+ }
+}
diff --git a/SignInUsingGoogle/SignInUsingGoogle/Info.plist b/SignInUsingGoogle/SignInUsingGoogle/Info.plist
index 0c71ccc..d22838d 100644
--- a/SignInUsingGoogle/SignInUsingGoogle/Info.plist
+++ b/SignInUsingGoogle/SignInUsingGoogle/Info.plist
@@ -2,6 +2,8 @@
+
+
CFBundleURLTypes
@@ -9,7 +11,8 @@
Editor
CFBundleURLSchemes
- com.googleusercontent.apps.933516339475-kfk1mqog5ufdrvn46oitoeh7t3riqj83
+ com.googleusercontent.apps.178993694439-fvss3daue1hsa51h2ugi82pknkqjuj37
+ 178993694439-fvss3daue1hsa51h2ugi82pknkqjuj37.apps.googleusercontent.com
diff --git a/SignInUsingGoogle/SignInUsingGoogle/Screen/Home.swift b/SignInUsingGoogle/SignInUsingGoogle/Screen/Home.swift
index bce692d..98ca092 100644
--- a/SignInUsingGoogle/SignInUsingGoogle/Screen/Home.swift
+++ b/SignInUsingGoogle/SignInUsingGoogle/Screen/Home.swift
@@ -2,19 +2,17 @@
// Home.swift
// SignInUsingGoogle
//
-// Created by Swee Kwang Chua on 12/5/22.
+// Created by Alumno on 9/09/24.
//
import SwiftUI
struct Home: View {
var body: some View {
- Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
+ Text("Hello, World! y" )
}
}
-struct Home_Previews: PreviewProvider {
- static var previews: some View {
- Home()
- }
-}
+#Preview {
+ Home()
+}
diff --git a/SignInUsingGoogle/SignInUsingGoogle/Screen/LoginScreen.swift b/SignInUsingGoogle/SignInUsingGoogle/Screen/LoginScreen.swift
index 6e43e5c..ab7d3e4 100644
--- a/SignInUsingGoogle/SignInUsingGoogle/Screen/LoginScreen.swift
+++ b/SignInUsingGoogle/SignInUsingGoogle/Screen/LoginScreen.swift
@@ -2,10 +2,13 @@
// ContentView.swift
// SignInUsingGoogle
//
-// Created by Swee Kwang Chua on 12/5/22.
+// Created by Alumno on 9/09/24.
//
import SwiftUI
+import FirebaseAuth
+import GoogleSignIn
+import Firebase
struct LoginScreen: View {
@State var username: String = ""
@@ -13,6 +16,9 @@ struct LoginScreen: View {
var body: some View {
VStack {
+ Image("LogoTec")
+ .resizable()
+ .frame(width:100, height: 100)
VStack {
LoginHeader()
.padding(.bottom)
@@ -37,7 +43,13 @@ struct LoginScreen: View {
GoogleSiginBtn {
// TODO: - Call the sign method here
-
+ FirebAuth.share.signinWithGoogle(presenting: getRootViewController()) { error in
+ if let error = error {
+ print("Error signing in with Google: \(error.localizedDescription)")
+ } else {
+ print("Successfully signed in with Google")
+ }
+ }
} // GoogleSiginBtn
} // VStack
.padding(.top, 52)
@@ -47,8 +59,7 @@ struct LoginScreen: View {
}
-struct LoginScreen_Previews: PreviewProvider {
- static var previews: some View {
- LoginScreen()
- }
+#Preview{
+ LoginScreen()
}
+
diff --git a/SignInUsingGoogle/SignInUsingGoogle/SignInUsingGoogleApp.swift b/SignInUsingGoogle/SignInUsingGoogle/SignInUsingGoogleApp.swift
index 3724c23..576296b 100644
--- a/SignInUsingGoogle/SignInUsingGoogle/SignInUsingGoogleApp.swift
+++ b/SignInUsingGoogle/SignInUsingGoogle/SignInUsingGoogleApp.swift
@@ -2,13 +2,14 @@
// SignInUsingGoogleApp.swift
// SignInUsingGoogle
//
-// Created by Swee Kwang Chua on 12/5/22.
+// Created by Alumno on 9/09/24.
//
import SwiftUI
@main
struct SignInUsingGoogleApp: App {
+ @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
@AppStorage("signIn") var isSignIn = false
var body: some Scene {
diff --git a/SignInUsingGoogle/SignInUsingGoogle/View/CustomButton.swift b/SignInUsingGoogle/SignInUsingGoogle/View/CustomButton.swift
index 9e65038..c54763f 100644
--- a/SignInUsingGoogle/SignInUsingGoogle/View/CustomButton.swift
+++ b/SignInUsingGoogle/SignInUsingGoogle/View/CustomButton.swift
@@ -2,7 +2,7 @@
// CustomButton.swift
// SignInUsingGoogle
//
-// Created by Swee Kwang Chua on 4/9/22.
+// Created by Alumno on 9/09/24.
//
import SwiftUI
diff --git a/SignInUsingGoogle/SignInUsingGoogle/View/CustomTextfield.swift b/SignInUsingGoogle/SignInUsingGoogle/View/CustomTextfield.swift
index 3ca0be4..933cb36 100644
--- a/SignInUsingGoogle/SignInUsingGoogle/View/CustomTextfield.swift
+++ b/SignInUsingGoogle/SignInUsingGoogle/View/CustomTextfield.swift
@@ -2,7 +2,7 @@
// CustomTextfield.swift
// SignInUsingGoogle
//
-// Created by Swee Kwang Chua on 4/9/22.
+// Created by Alumno on 9/09/24.
//
import SwiftUI
diff --git a/SignInUsingGoogle/SignInUsingGoogle/View/GoogleSiginBtn.swift b/SignInUsingGoogle/SignInUsingGoogle/View/GoogleSiginBtn.swift
index 3c4436a..ca9f99e 100644
--- a/SignInUsingGoogle/SignInUsingGoogle/View/GoogleSiginBtn.swift
+++ b/SignInUsingGoogle/SignInUsingGoogle/View/GoogleSiginBtn.swift
@@ -2,7 +2,7 @@
// GoogleSiginBtn.swift
// SignInUsingGoogle
//
-// Created by Swee Kwang Chua on 12/5/22.
+// Created by Alumno on 9/09/24.
//
import SwiftUI
diff --git a/SignInUsingGoogle/SignInUsingGoogle/View/LoginHeader.swift b/SignInUsingGoogle/SignInUsingGoogle/View/LoginHeader.swift
index 26cfefe..de0514e 100644
--- a/SignInUsingGoogle/SignInUsingGoogle/View/LoginHeader.swift
+++ b/SignInUsingGoogle/SignInUsingGoogle/View/LoginHeader.swift
@@ -2,7 +2,7 @@
// LoginHeader.swift
// SignInUsingGoogle
//
-// Created by Swee Kwang Chua on 4/9/22.
+// Created by Alumno on 9/09/24.
//
import SwiftUI
@@ -10,14 +10,16 @@ import SwiftUI
struct LoginHeader: View {
var body: some View {
VStack {
- Text("Hello Again!")
+ Text("Hola! Bienvenido a Bufetec")
.font(.largeTitle)
- .fontWeight(.medium)
+ .multilineTextAlignment(.center)
+ //.fontWeight(.medium)
.padding()
- Text("Welcome to back, You've \nbeen missed")
+ Text("Haz login para acceder a tu perfil y tus casos")
+ .tint(.secondary)
.multilineTextAlignment(.center)
- }
+ .padding(.top,2) }
}
}