티스토리 뷰

iOS

iOS) CocoaPods 사용하기

Ekko0701 2022. 8. 23. 18:05

CocoaPods 이란?

CocoaPods는 Swift 및 Objective-C Cocoa 프로젝트의 종속성 관리자. 91,000개 이상의 라이브러리가 있으며 300만 개 이상의 앱에서 사용된다. CocoaPods을 사용하면 프로젝트를 우아하게 확장할 수 있다.

 

CocoaPods Guides

CocoaPods is fully open-sourced, so it depends on community contributions to get better. If you're looking to start working on CocoaPods, this is the place to start.

guides.cocoapods.org

 

1. 설치

터미널에 다음 명령어를 입력

$ sudo gem install cocoapods

 

 

2. 터미널에서 프로젝트 폴더로 이동

 

 

3. Podfile 생성

$ pod init

 

 

4. Podfile 열기

xcode를 사용해 Podfile을 열어주자.

 $ open Podfile -a Xcode

(vi, vim, nano로 진행해도 오케이)

앞으로 이 Podfile을 통해 프로젝트의 cocoapod 라이브러리를 관리할 것이다.

 

 

5. 라이브러리 추가 후 저장

사용하고 싶은 라이브러리를 Podfile에 추가해주자.

 

이번엔 CocoaPods 홈페이지에서 찾은 SwipeCellKit 추가.

pod 'SwipeCellKit'

 

라이브러리의 설치 방법이나 버전은 그 라이브러리의 Github을 참고하자.

 

나는 SwipeCellKit 라이브러리를 최신 버전으로 설치했다.

 

GitHub - SwipeCellKit/SwipeCellKit: Swipeable UITableViewCell/UICollectionViewCell based on the stock Mail.app, implemented in S

Swipeable UITableViewCell/UICollectionViewCell based on the stock Mail.app, implemented in Swift. - GitHub - SwipeCellKit/SwipeCellKit: Swipeable UITableViewCell/UICollectionViewCell based on the s...

github.com

 

 

6. 라이브러리 설치

$ pod install

M1칩 오류 참고

 

iOS) pod install error 해결

M1 맥북을 초기화하고 cocoaPods을 설치하던 도중에 error를 발견했다. podfile에 pod을 추가하고 pod install을 했는데 루비 어쩌구 저쩌구 .. 다음의 사이트들을 참고해서 해결했다. Bug #18555: Running "bund..

ekko.tistory.com

 

 

7. 프로젝트명.xcworkspace 에서 작업

라이브러리를 사용하기 위해서는 새로 생성된 .xcworkspace에서 작업하자.

 

 

8. 라이브러리 import 후 사용

라이브러리 import

import SwipeCellKit

 

라이브러리의 깃헙을 참고해서 사용하면 끝..!

공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/07   »
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 29 30 31
글 보관함