Rxswift: playground does not work in swift 4

Created on 6 May 2018  路  2Comments  路  Source: ReactiveX/RxSwift

screen shot 2018-05-06 at 9 56 30 am
hi
I'm trying to use rx.playground. I built the rxSwift-macOS successfully
but when I go to rx playground the debug area shows nothing! I tried using TryYourself.playground still
nothing, I commented out everything and just printed "hi" but nothing seems to work.
could anyone help me please?

I'm using Xcode 9.3 and macOS HighSierra.

All 2 comments

Hi @SNThunderbolt ,

please fill issue template.

Keep it simple by think out of the box.
Create a sample project (not playground).
Declare function & variable as normal then it's work like a charm.

import RxSwift

func example(of description: String, completion: () -> ()) {
print("--- Example of: (description) ---")
completion()
}
class ViewController: UIViewController {
let one = 1
let two = 2
let three = 3

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
    let observable1: Observable<Int> = Observable<Int>.just(one)
    let observable2 = Observable.of(one, two, three)
    let observable3 = Observable.of([one, two, three])
    let observable4 = Observable.from([one, two, three])

    example(of: "subscribe") {
        observable2.subscribe { (event) in
            print(event)

            if let element = event.element {
                print(element)
            }
        }
    }
}

}

Was this page helpful?
0 / 5 - 0 ratings