일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- swift documentation
- SWIFT
- 애니메이션
- RxCocoa
- rxswift
- 리팩토링
- Clean Code
- 리펙토링
- Refactoring
- 리펙터링
- 스위프트
- combine
- Xcode
- UITextView
- UICollectionView
- uiscrollview
- ios
- Protocol
- ribs
- collectionview
- Observable
- 클린 코드
- map
- clean architecture
- MVVM
- uitableview
- swiftUI
- HIG
- Human interface guide
- tableView
- Today
- Total
목록API (5)
김종권의 iOS 앱 개발 알아가기
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/cYkULk/btrr2Tf5yfg/nSa4qg13wOlDhXxk5T4IB0/img.gif)
1. RxSwift의 Map, FlatMap - 사용하여 비동기를 순서대로 처리 방법 2. RxSwift의 Map, FlatMap - 사이드 이펙트 처리 방법 (throw와 catch 사용) 편리를 위해 사용한 프레임워크 # UI pod 'SnapKit' pod 'Then' # Rx pod 'RxSwift' pod 'RxCocoa' # Network pod 'Moya/RxSwift' # Utils pod 'JGProgressHUD' # 로딩 사용한 API - Unsplash 이미지 조회를 위한 API https://unsplash.com/documentation 비동기 작업 순서 `확인` 버튼 탭 API를 통해서 이미지 url 획득, url을 UILabel에 입력 로딩 프로그래스 바 표출 후, url을 ..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/bBRan2/btrhUlmy8N0/K2hMecnf2esSx2Ees86Tj1/img.jpg)
1. Alamofire 사용 방법 - Network Layer 구현 (Moya 프레임워크처럼 사용하는 방법) 2. Alamofire 사용 방법 - 토큰 갱신 방법1 (Interceptor, adapt, retry) 3. Alamofire 사용 방법 - 토큰 갱신 방법2 (AuthenticationCredential, Authenticator, AuthenticationInterceptor) 4. Alamofire 사용 방법 - 로그 Log (EventMonitor) Alamofire를 이용한 Network Layer Network/Bases TargetType은 API들의 공통 Endpoint를 가지고 있는 모듈 Alamofire에 내장되어 있는 protocol인 URLRequestConvertible의..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/ew058M/btrcebb0JR8/Ui2Qfbg50Gs0U7yXp5uoh1/img.png)
API 테스트 사이트 참고 무료 API 테스트 사이트: https://reqres.in/ 위 링크 클릭, 복사: https://reqres.in/api/users?page=2 데이터 형식이 page, per_page, total, total_pages, data 형식인 경우 대응 - 두 데이터 사용 예정 Moya 프레임워크 네트워크 기본인 URL Session 개념 참고 moya 프레임워크 개념 참고 다운 > swift Package Manager > https://github.com/Moya/Moya.git Network 설계 주요 4가지 파일 NetworkLoggerPlugin: 네트워크 통신 시 MoyaProvider라는 객체를 통해 접근하는데, MoyaProvider의 파라미터 값으로 plug..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/U6bfG/btqK6Ou8vB5/I3b0TKaYAPlMB4cawbTxf1/img.png)
Codable이란? Encodable + Decodable 두 속성 모두 가지고 있는 타입 Encodable: 스위프트의 struct구조의 "객체"를 "json형식"으로 변한 하는 것 (Binary Data로 변환) Decodable: "json형식"을 "객체"로 변환 필요한 이유: 서버와 통신할 경우, 객체 그대로를 보내지 / 받지 않고, Binary Data로 통신 Encode swift의 struct객체 -> Binary Data (json형) struct정의 struct Person: Codable { var name: String var age: Int var birthDate: Date } Encode_ Binary데이터 변환 // create let person = Person(name: "..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/siI1U/btqEzeTYjyI/P1ErjLuMrPjTGRXQF5GJ2K/img.png)
1. URL API REQ 1) map을 이용하여 원소에 접근하여 최종적으로 URLRequest획득 // viewDidLoad().swoft DispatchQueue.global(qos: .default).async { [weak self] in let response = Observable.from([repo]) .map { urlString -> URL in return URL(string: "https://api.github.com/repos/\(urlString)/events")! }.map { url -> URLRequest in return URLRequest(url: url) } } 2) flatMap을 이용하여 새로운 Observable생성 *map이 아닌 flatMap을 사용하는 이유 -..