본문 바로가기

UIKIT

(149)
🔥 MVVM + Combine을 활용한 소셜 로그인 & 이메일 회원가입 https://explorer89.tistory.com/360 AnyPublisher { return Future { promise in Auth.auth().signIn(with: credential) { authResult, error in if let error = error { promise(.failure(error)) // " data-og-host="explorer89.tistory.com" data-og-source-url="https://explorer89.tistory.com/360" data-og-url="https://explorer89.tistory.com/360" data-og-image="https://scrap.kakaocdn.net/dn/bR0F7D/hyYjtptys4/JH..
🤔 소셜 미디어 로그인 방법에서 Future를 사용한 이유? func signIn(with credential: AuthCredential) -> AnyPublisher { return Future { promise in Auth.auth().signIn(with: credential) { authResult, error in if let error = error { promise(.failure(error)) // 에러 처리 } else if let user = authResult?.user { promise(.success(user)) // 성공 } } } .eraseToAnyPublisher()}✅ ..
🤔 Combine에서 Future를 사용하는 이유 https://explorer89.tistory.com/361 🤔 Future란? (Combine의 비동기 처리)https://developer.apple.com/documentation/combine/future Future | Apple Developer DocumentationA publisher that eventually produces a single value and then finishes or fails.developer.apple.com 🚀 Future란? (초보자를 위한 쉬운 설명)Future는explorer89.tistory.com 🤔 Combine에서 Future를 쓰는 의미?Combine은 비동기 이벤트 스트림을 처리하는 프레임워크그런데 Combine의 기본 Publishe..
🤔 Future란? (Combine의 비동기 처리) https://developer.apple.com/documentation/combine/future Future | Apple Developer DocumentationA publisher that eventually produces a single value and then finishes or fails.developer.apple.com 🚀 Future란? (초보자를 위한 쉬운 설명)Future는 한 번만 데이터를 방출(emit)하는 Combine의 Publisher.즉, 비동기 작업을 수행하고 결과(성공 or 실패)를 한 번만 전달한 후 종료하는 역할 💡 예제:네트워크 요청 후 응답을 받으면 결과를 반환비동기 작업(예: 파일 다운로드, 인증 처리 등) 후 단 한 번만 값을 반환 📌 Futu..
🔥 Firebase의 회원가입 (이메일&비밀번호 / 소셜로그인) // ✅ 소셜 로그인 (Facebook, Google, Apple 등)func signIn(with credential: AuthCredential) -> AnyPublisher { return Future { promise in Auth.auth().signIn(with: credential) { authResult, error in if let error = error { promise(.failure(error)) // 에러 처리 } else if let user = authResult?.user { promise(.success(user)) // 성공 } ..
날짜 형식 변환 📌 날짜 형식 변환 (2025-2-11 → 2월 11일 2025년)🔷 TMDB API를 통해 받아오는 데이터 중 released_date의 날자 형식을 변경{ "page": 1, "results": [ { ... "popularity": 396.136, "release_date": "2025-01-15", ... }, ... movie.releaseDate는 "2025-2-11" 형식의 String이므로, 1️⃣ 먼저 Date 타입으로 변환한 후 2️⃣ 원하는 형식으로 다시 String으로 변환  🚀 해결 방법🔹 Step 1: String → Date 변환현재 날짜 형식 "2025-2-11"은 "yyyy-M-d" 형태따라서 DateFormatt..
특정 문구만 크기를 다르게 하는 방법 영화 선호도 점수의 텍스트 크기 및 색상 개별 적용하기 위해서는 "NSMutableAttributedString"를 사용하면 됩니다. private let scoreLabel: UILabel = { let label = UILabel() label.textAlignment = .center label.font = .systemFont(ofSize: 14, weight: .bold) // 기본 폰트 크기 label.backgroundColor = .clear label.layer.cornerRadius = 20 label.clipsToBounds = true // ✅ "55%"에서 "%"만 크기 줄이고, "55"는 초록색으로 변경 let fullText = "55..
Core Data + FileManager + Combine + MVVM 구조 핵심 아이디어는 이미지를 디스크에 저장하고, 그 경로(상대 경로)를 Core Data에 저장하는 것입니다. Create (새 피드를 생성할 때):이미지를 먼저 FeedStorageManager로 저장 → 저장된 상대 경로 배열을 FeedItem.imagePath에 설정 → Core Data에 FeedModel 엔티티로 저장Fetch (피드를 불러올 때):Core Data에서 FeedItem을 가져옴 → 필요한 경우 FeedStorageManager.loadImages로 실제 UIImage를 불러올 수 있음Update (기존 피드 수정 시):기존에 저장된 이미지를 삭제하고, 새 이미지가 있으면 다시 저장 → Core Data 업데이트Delete (피드 삭제 시):해당 피드에 연결된 이미지들을 FileMan..