https://console.firebase.google.com/
https://github.com/firebase/firebase-ios-sdk
//
// Firebase_AuthApp.swift
// Firebase Auth
//
// Created by Cairocoders
//
import SwiftUI
import Firebase
@main
struct Firebase_AuthApp: App {
init() {
FirebaseApp.configure()
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
//
// ContentView.swift
// Firebase Auth
//
// Created by Cairocoders
//
import SwiftUI
import Firebase
struct ContentView: View {
@State var email = ""
@State var password = ""
var body: some View {
VStack {
TextField("Email", text: $email)
SecureField("Password", text: $password)
Button(action: { login() }) {
Text("Sign In")
}
}
.padding()
}
func login(){
Auth.auth().signIn(withEmail: email, password: password) { result, error in
if error != nil {
print(error?.localizedDescription ?? "")
}else {
print("success")
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
