Closed heemings closed 2 months ago
๋ก๊ทธ์ธ, ํ์๊ฐ์ , ์๋๋ก๊ทธ์ธ ๊ตฌํ
func loginAPI(id: String, password: String, completion: @escaping (Bool) -> Void) { provider.request(.login(id: id, password: password)) { result in DispatchQueue.main.async { switch result { case let .success(response): if let tokenResponse = try? response.map(TokenResponse.self) { TokenManager.shared.accessToken = tokenResponse.access_token TokenManager.shared.refreshToken = tokenResponse.refresh_token completion(true) } else { completion(false) } case .failure: completion(false) } } } }
์ด ๋ถ๋ถ์ด ๊ฐ์ฅ ์ด๋ ต๊ฒ ๋๊ปด์ก๋๋ฐ ์ฐจ๋ก๋๋ก ๋ฐ๋ผ๊ฐ๋ฉด์ ๊ณต๋ถํด๋ณด๋ ๋ก๊ทธ์ธ ๋ก์ง์ ๋ํด ์ดํดํ ์ ์์๋ค
์์ ํ์๋ฉด์ ๊ถ๊ธํ๋ ์ง๋ฌธ๋ค์ ๋จ๊ฒจ์ฃผ์ธ์.
๐Summary
๋ก๊ทธ์ธ, ํ์๊ฐ์ , ์๋๋ก๊ทธ์ธ ๊ตฌํ
๐กPR Point
์ด ๋ถ๋ถ์ด ๊ฐ์ฅ ์ด๋ ต๊ฒ ๋๊ปด์ก๋๋ฐ ์ฐจ๋ก๋๋ก ๋ฐ๋ผ๊ฐ๋ฉด์ ๊ณต๋ถํด๋ณด๋ ๋ก๊ทธ์ธ ๋ก์ง์ ๋ํด ์ดํดํ ์ ์์๋ค
๐ค Question
๐ย Simulator