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?
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?
Rx.xcworkspace
RxSwift-macOS
schemeRx.playground
in the Rx.xcworkspace
tree view and add a new pageimport RxSwift
in the new page.View > Debug Area > Show Debug Area
it's super easy:
As @sas has hinted at, you can use Arena.
To be more specific:
One line to install Arena:
brew install finestructure/tap/arena
One line to create your RxSwift enabled Playground:
arena https://github.com/ReactiveX/RxSwift
Results:
➡️ Package: https://github.com/ReactiveX/RxSwift @ from(5.1.1)
Resolving package dependencies ...
Libraries found: RxSwift, RxCocoa, RxRelay, RxBlocking, RxTest
Building package dependencies ...
✅ Created project in folder 'Arena-Playground'
Done! Open Arena-Playground
and find your Playground (probably called MyPlayground), code there. It may require a click on Product -> Build to get going the first time.
No longer works in Xcode 9.1
$ pod playgrounds RxSwift,RxCocoa
gives
Errno::ENOENT - No such file or directory @ dir_initialize - /Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File Templates/Source/Playground with Platform Choice.xctemplate
@Jason, you need to run following commands:
$ gem install cocoapods-playgrounds
$ pod playgrounds RxSwift,RxCocoa
and it'll work. The second command opens a workspace with already added pods. Just remember to first build a target and then you can play with your new playground.
That so easy!
Create playground in your project(of course you need to need to add the dependency of RxSwift)
In Xcode project navigation, below the playground file, you will find a folder named source
Create this swift file in this folder: https://github.com/ReactiveX/RxSwift/blob/master/Rx.playground/Sources/SupportCode.swift
Then enjoy it!
// example
import RxSwift
playgroundShouldContinueIndefinitely()
example("of") {
let disposeBag = DisposeBag()
Observable.of("", "", "", "")
.subscribe(onNext: { element in
print(element)
})
}