Swift/Tips & Tricks

Rx Swift Cocoa pods 로 설치하기, playground 연습 환경 구축

iosswift 2022. 3. 23. 00:08

설치하기 !!!

 

1. Cocoapods 를 설치한다.

(Terminal 에 입력)

sudo gem install cocoapods

2. Current Folder 로 이동한다.

 

3. pod init -> podfile 이 생성된다.

pod init

 

4. podfile 로 들어가서 수정 후 저장, 닫는다.

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'RxSwiftProj' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for RxSwiftProj
   pod 'RxSwift', '6.5.0'
end

 

5. pod install -> .xcworkspace file 이 생성된다 !

pod install

그 후 코딩은 .xcworkspace 에 하면 된다 ! 

 

 

(Cocoa pod 에 새로 추가할게 있으면, 간단히 Podfile 에 위 4 번 과정과 동일하게 추가 후에 pod install 하면 된다 ( 5번 과정. ) 

 

 

 

playground 연습 환경 구축하기 !!!

 

( 0.  RxSwift 를 원하는 프로젝트에 설치했다고 가정 )

 

1. 새로 Playground 파일을 만든다.

 

2. .xcworkspace 를 실행시킨 프로젝트 내에서 폴더를 우클릭 후, Add Files to "<fileName>" 을 클릭한다.

 

 

 

3. 그러면 아래 화면과 같이 나온다. 

4. 여기 화면에서 위와 같이 체크 한 후 'Add' 버튼을 누른다. 

 

 

 

 

5. 그러면 다음과 같이 테스트 환경을 구축할 수 있다 !! 

 

 

 

 

Udemy 

Mohammad Azam의 

Reactive Programming Using Swift Programming Language

참고