250x250
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- iOS 개발자
- 비전공 개발자
- jQuery
- image
- 비전공자
- Animation
- MAC
- 개발자
- 풀스택
- 백엔드
- react
- javascript
- xcode
- php
- ipad
- effect
- html5
- keyframes
- 자바스크립트
- IOS
- front-end
- hover
- CSS
- button
- 프론트엔드
- SWIFT
- iPhone
- HTML
- 애니메이션
- css3
Archives
- Today
- Total
비전공자 개발일기
Firebase Auth(Email / Password Login) 본문
728x90
SMALL
// AppDelegate
import UIKit
import Firebase
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
FirebaseApp.configure()
return true
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}
// 계정등록, 로그인 ViewController
...
import FirebaseAuth
...
// 계정 등록 버튼 클릭 관련 함수에 아래 코드 사용
FirebaseAuth.Auth.auth().createUser(withEmail: email, password: password, completion: { authResult, error in
guard let result = authResult, error == nil else {
print("Error creating user")
return
}
let user = result.user
print("Created User: \(user)")
})
// 로그인 버튼 클릭 관련 함수에서 아래 코드 사용
FirebaseAuth.Auth.auth().signIn(withEmail: email, password: password, completion: { authResult, error in
guard let result = authResult, error == nil else {
print("Failed to log in user with email: \(email)")
return
}
let user = result.user
print("Logged in User: \(user)")
})
728x90
LIST
'SWIFT' 카테고리의 다른 글
Memo App made by SwiftUI (0) | 2023.01.17 |
---|---|
Log Out (0) | 2023.01.16 |
Choose a picture in iPhone's photo library(UIImagePickerController) (0) | 2023.01.14 |
MVC Pattern (0) | 2023.01.13 |
UIView Border by storyboard (0) | 2023.01.10 |