This might be a possible duplicate of Xcode 9 crashes when debugging in swift however since I have a new account I can't comment over there.
I'm using XCode 9.1 (9B55) and RxSwift / RxCocoa 4.0.0
I'm trying to migrate my TableView code to RxSwift but every time my ViewController loads in the Simulator or on my device, XCode crashes along with the app.
The ViewController is set as my UIWindow's rootViewController so it's the first thing that loads in the app.
Here is my simplified ViewController:
import UIKit
import RxSwift
import RxCocoa
struct DummyProfile {
let name: String
let vid: String
let userName: String
}
class ProfilesCollectionViewController: UITableViewController {
private let disposeBag = DisposeBag()
let profileList = [
DummyProfile(name: "Test1", vid: "VIDASLKDHASKLDH", userName: "User"),
DummyProfile(name: "Test1adasidhaskljdhaskljdhaksldhjaskdha", vid: "VIDASLKDHASKLDH", userName: "User"),
DummyProfile(name: "86435543536543455324", vid: "VIDASLKDHASKLDH", userName: "fluigadshkljdhkldjsfgh ask jgfhaklseth kjahgkds")
]
override func viewDidLoad() {
super.viewDidLoad()
tableView.register(ProfileCell.self, forCellReuseIdentifier: "ProfileCell")
tableView?.alwaysBounceVertical = true
tableView?.backgroundColor = .lightGray
Observable.just(profileList).bind(to: tableView.rx.items(cellIdentifier: "ProfileCell", cellType: ProfileCell.self)) { (_, model, cell) in
cell.viewModel = model
}.disposed(by: disposeBag)
}
}
I don't think that the code for my ProfileCells is important since it's basically just a few UIViews and the AutoLayout stuff and everything is confirmed working when I don't use RxCocoa / RxSwift.
Here is one of the XCode Crash Reports. I don't have anything else to go on:
Am I doing something very wrong or is this a bug somewhere in my Toolchain?
I had similar situation, but
tableView.datasource = nil
in viewDidLoad() of UITableViewController did the trick