3

I'm trying some RXSwift code in a playground, and XCode keeps freezing every several minutes with the rainbow spinner. Then XCode stops responding and has to be force quit and restarted. This is happening across multiple projects and Macs. Regular RXSwift code in project files does not cause crashes.

How can I fix XCode freezing when working with RXSwift in playground mode?

import RxSwift
import RxCocoa
import PlaygroundSupport
import Foundation

var str = "Hello, playground"
print(str)

let subject = BehaviorSubject(value: "seed")

let replayed = subject.replay(1)

let sequence = Observable.of("first","Second") //random crashes as I type and the console outputs error messages.

replayed.connect()

replayed.subscribe(onNext: { value in
    print(value)
}, onError: { error in
    print("Received Error")
}, onCompleted: {
    print("Received Completion")
})

Here's my podfile:

platform :ios, '11.0'

use_frameworks!

pod 'RxSwift'
pod 'RxCocoa'

target 'RxSwiftPlayground'



post_install do |installer|

    installer.pods_project.build_configurations.each do |config|
        config.build_settings.delete('CODE_SIGNING_ALLOWED')
        config.build_settings.delete('CODE_SIGNING_REQUIRED')
    end

    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['CONFIGURATION_BUILD_DIR'] = '$PODS_CONFIGURATION_BUILD_DIR'
        end
    end
end

I think the only symptom I have is that after force quit, I get this error in console until I rebuild the project (it was compiling and had code completion before the freeze)

Playground execution failed:

    error: RxSwift.playground:3:8: error: no such module 'RxSwift'
    import RxSwift
Alex Stone
  • 46,408
  • 55
  • 231
  • 407

0 Answers0