Search
moon
sun

(Swift) cocoapods 시작하기 & 간단 사용법

간단소개
팔만코딩경 컨트리뷰터
ContributorNotionAccount
주제 / 분류
Swift
Scrap
태그
9 more properties

1. cocoapods 설치

cocoapods가 없다면 미리 설치해두자
sudo gem install cocoapods
Swift
복사

2. 프로젝트에 cocoapods 적용하기

// xcode project 파일이 있는 위치에서 pod init
Swift
복사
pod init 명령을 사용하면 아래 그림과 같이 Podfile이 생긴 것을 볼 수 있다.

3. 필요한 라이브러리 추가하기

필요한 라이브러리를 Podfile에 추가한다!
# Uncomment the next line to define a global platform for your project # platform :ios, '9.0' platform :ios, '10.0' target 'DuelDice' do # Comment the next line if you don't want to use dynamic frameworks use_frameworks! # Pods for DuelDice pod 'Firebase/Auth' pod 'Firebase/Core' pod 'GoogleSignIn' pod 'FBSDKLoginKit' target 'DuelDiceTests' do inherit! :search_paths # Pods for testing end target 'DuelDiceUITests' do # Pods for testing end end
Swift
복사

4. 라이브러리 설치

다시 터미널로 돌아가 라이브러리 설치를 진행한다.
pod install
Swift
복사

5. 프로젝트 X, 워크스페이스 열기

아래 명령어를 사용해서 워크스페으스로 접근한다.
❗ .xcodeproj 로 접근하면 cocoapods라이브러리를 사용할 수 없다!
open project_name.xcworkspace
Swift
복사
끝!