[iOS] Cocoapods (1)

2020. 5. 23. 13:25iOS

1. Cocoapods (1)

1) Cocoapods
외부 라이브러리 관리를위한 표준 형식을 제공하는 응용 프로그램 레벨 종속성 관리자이다.

2) Homebrew 설치

Homebrew 설치

3) Cocoapods 설치 (1.9.1)

일반 터미널에서도 설치가 가능하다.

Cocoapods 설치

4) Cocoapods 준비

pod init 적용 전, 후

5) Alamofire 설치

가장 대중적으로 잘 알려진 네트워크 라이브러리이다.

vi Podfile
pod install

6) AlamofireObjectMapper 설치

모델 객체를 JSON과 손쉽게 상호 변환할 수 있는 라이브러리이며, Alamofire, Realm 등 다른 라이브러리와도 손쉽게 연계 가능하다. ObjectMapper를 설치하면서 요구되는 Alamofire의 버전과 다를 경우 오류가 발생하는 경우가 있으며, 요구되는 Alamofire 버전을 정의하여 해결할 수 있다.

vi Podfile
pod install

7) Alamofire SwiftyJson

Swift에서 다루기 힘든 Json을 편하게 도와주는 라이브러리이다.

vi Podfile
pod install

8) Podfile.lock

vi Podfile.lock

※ 기존에 존재하는 파일 외에 파일들이 생성이 되며, 기존의 파일을 삭제 시 문제가 생길 수 있다.
※ 기존 xcodeproj를 열었을 경우, 추가된 라이브러리 파일을 사용할 수 없기 때문에 workspace 파일로만 작업한다.


[참고] hcn1519.github.io/articles/2017-07/iOS_URLSession
[참고] meetup.toast.com/posts/213
[참고] cocoapods.org/
[참고] brew.sh/index_ko
[참고] blog.yagom.net/532/
[참고] github.com/Alamofire/Alamofire
[참고] github.com/tristanhimmelman/AlamofireObjectMapper
[참고] github.com/SwiftyJSON/Alamofire-SwiftyJSON

728x90

'iOS' 카테고리의 다른 글

[iOS] 학교 앱  (0) 2020.05.24
[iOS] Cocoapods (2)  (0) 2020.05.23
[iOS] 연락처 앱  (0) 2020.05.23
[iOS] Userdefaults, CoreData  (0) 2020.05.23