Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import RxSwift in Playground of xcode?

I am trying to import rxswift in xcode playground by this:

gem install cocoapods-playgrounds

and after that

pod playgrounds RxSwift

But it is not happening. How to do it?

like image 264
Istiak Morsalin Avatar asked Feb 07 '17 06:02

Istiak Morsalin


People also ask

How do I add a playground to my Xcode project?

To open Playground on Xcode, navigate to File in the menu and click on New > Playground... To test our square function, we will choose the Blank template. Name your Playground file, then click on Create.


2 Answers

  1. You should clone the RxSwift repository on your computer
  2. Open Rx.xcworkspace
  3. Build the RxSwift-macOS scheme
  4. Open Rx.playground in the Rx.xcworkspace tree view and add a new page
  5. import RxSwift in the new page.
  6. Choose View > Debug Area > Show Debug Area

steps 3 and 4

step 5

like image 159
xandrefreire Avatar answered Sep 20 '22 12:09

xandrefreire


it's super easy:

  1. Create a new project, Xcode menu > File > New > Project… (Single View App)
    1. Close Xcode
    2. Initialize pods in the new project (pod init in terminal)
    3. Edit Podfile, add RxSwift, RxCocoa
    4. Install pods (pod install in terminal)
    5. Open RxSwiftProject.xcworkspace created by CocoaPods
    6. Build and run project using default scheme
    7. Add a new playground, Xcode menu > File > New > Playground…
    8. Select Add to: RxSwiftProject , to add it to the RxSwift workspace
    9. Save it in the workspace folder

example code here

like image 20
abdallah shawky Avatar answered Sep 20 '22 12:09

abdallah shawky