본문 바로가기

UIKIT

(149)
🔍 Firebase Storage listAll(completion:) 설명 https://explorer89.tistory.com/380 🔥 Firebase의 Storage 내에 저장된 여러 이미지 삭제하기!https://firebase.google.com/docs/storage/ios/delete-files?hl=ko Apple 플랫폼에서 Cloud Storage로 파일 삭제  |  Cloud Storage for Firebase4월 9~11일, Cloud Next에서 Firebase가 돌아옵니다. 지금 등록하기 의견 보내기 Apple 플explorer89.tistory.com 🔍 Firebase Storage listAll(completion:) 설명🔹 기능listAll(completion:)은 Firebase Storage에서 특정 경로 아래의 모든 파일(items)..
🤔 Completion Handler를 Combine으로 변경할 때 고려해야 할 점? 🤔 Firebase 에서 제공되는 기본 코드는 Completion Handler 기반... 이를 Combine으로 바꾸려면? 🎯 Combine 변환 시 고려해야 할 사항1️⃣ Future는 한 번만 실행되는 Publisher→ 비동기 작업이 여러 번 실행되면 PassthroughSubject나 CurrentValueSubject가 더 적절할 수도 있음.2️⃣ 비동기 요청 순서 보장→ listAll()이 완료되기 전에 delete()를 실행하지 않도록 해야 함.→ flatMap()과 collect() 또는 DispatchGroup을 사용하여 비동기 흐름을 제어.3️⃣ UI 업데이트는 receive(on: DispatchQueue.main)을 사용하여 Main Thread에서 실행→ listAll()과 ..
🔥 Firebase의 Storage 내에 저장된 여러 이미지 삭제하기! https://firebase.google.com/docs/storage/ios/delete-files?hl=ko Apple 플랫폼에서 Cloud Storage로 파일 삭제  |  Cloud Storage for Firebase4월 9~11일, Cloud Next에서 Firebase가 돌아옵니다. 지금 등록하기 의견 보내기 Apple 플랫폼에서 Cloud Storage로 파일 삭제 컬렉션을 사용해 정리하기 내 환경설정을 기준으로 콘텐츠를 저장하고 분류하firebase.google.comhttps://firebase.google.com/docs/storage/ios/list-files?hl=ko Apple 플랫폼에서 Cloud Storage로 파일 나열  |  Cloud Storage for Firebas..
🔥 Firebase Storage에 이미지 업로드, 이미지 주소 URL 가져오기 func uploadAvatar() { let userID = Auth.auth().currentUser?.uid ?? "" // ✅ 유저 ID 가져오기 guard let imageData = imageData?.jpegData(compressionQuality: 0.5) else { return } // ✅ 이미지 데이터 변환 let metaData = StorageMetadata() // Firebase Storage 메타데이터 생성 metaData.contentType = "image/jpeg" // ✅ 파일 타입 설정 StorageManager.shared.uploadProfilePhoto(with: userID, image: imageData, metaData: met..
📍 Firebase 의 Storage 에 사진 업로드하는 방법 ✅ Firebase 의 Storage 에 저장하는 메서드images/{userID}/profileImage/profileImage_{userID}.jpg 경로를 사용해서 사용자별로 폴더를 구분나중에 리뷰 이미지 등 다른 카테고리를 추가할 확장성도 고려이 메서드는 Firebase Storage에 사용자의 프로필 이미지를 업로드하는 기능을 수행import Foundationimport FirebaseAuthimport FirebaseStorageimport FirebaseStorageCombineSwiftimport Combinefinal class StorageManager { // MARK: - Variable static let shared = StorageManager() ..
❓ FireStore 내에 회원정보를 불러오는 데 왜 tryMap? 🔥 tryMap { try $0.data(as: MovieClipUser.self) }의 역할 func collectionUsers(retrieve id: String) -> AnyPublisher { db.collection(userPath) .document(id) .getDocument() .tryMap { try $0.data(as: MovieClipUser.self) } // 🔥 여기가 핵심 .eraseToAnyPublisher()}🔹 각 단계별 동작1️⃣ db.collection(userPath).document(id).getDocument()Firestore에서 특정 문서(Document)를 가져오는 비동기 작업반환 타입: AnyP..
❓ Firebase 로그인 메서드 내 map의 역할 ✅ map(\.user)의 역할func loginUser(with email: String, password: String) -> AnyPublisher { return Auth.auth().signIn(withEmail: email, password: password) .map(\.user) // ✅ 여기서 map이 동작 .eraseToAnyPublisher()} 🔹 Firebase의 signIn(withEmail:password:)가 반환하는 타입➡️ signIn은 AnyPublisher를 반환해.➡️ 즉, AuthDataResult라는 객체가 반환되는데, 우리는 여기서 User 객체만 필요해.func signIn(withEmail email: String, ..
🚀 Future를 사용한 방식 vs map(\.user)을 사용한 방식의 차이점 (Future 는 필수인가?) 두 방식 모두 Firebase의 createUser(withEmail:password:)를 Combine을 활용하여 AnyPublisher 형태로 변환하지만, 비동기 처리 방식이 조금 다릅니다.   ✅ 1. Future를 사용한 방식func registerUser(with email: String, password: String) -> AnyPublisher { return Future { promise in Auth.auth().createUser(withEmail: email, password: password) { authResult, error in if let error = error { promise(.failure(error))..