I am trying to run the following test (page 310):
func testColorIsRedWhenHexStringIsFF0000_async() {
// 1
let expect = expectation(description: #function)
// 2
let expectedColor = UIColor(red: 1.0, green: 0.0, blue: 0.0, alpha: 1.0)
// 3
var result: UIColor!
// 1
viewModel.color.asObservable()
.skip(1)
.subscribe(onNext: {
// 2
result = $0
expect.fulfill()
})
.disposed(by: disposeBag)
// 3
viewModel.hexString.value = "#ff0000"
// 4
waitForExpectations(timeout: 1.0) { error in
guard error == nil else {
XCTFail(error!.localizedDescription)
return
}
// 5
XCTAssertEqual(expectedColor, result)
}
When I try to run this test, the project doesn’t compile and it produces the following error:
Undefined symbols for architecture x86_64:
“__T07RxCocoa21DriverSharingStrategyVN”, referenced from:
__T012TestingTests0A9ViewModelC027testColorIsRedWhenHexStringG12FF0000_asyncyyF in TestingViewModel.o
“__T07RxCocoa21DriverSharingStrategyVAA0dE8ProtocolAAWP”, referenced from:
__T012TestingTests0A9ViewModelC027testColorIsRedWhenHexStringG12FF0000_asyncyyF in TestingViewModel.o
“__T07RxCocoa14SharedSequenceV12asObservable0A5Swift0F0Cyq_GyF”, referenced from:
__T012TestingTests0A9ViewModelC027testColorIsRedWhenHexStringG12FF0000_asyncyyF in TestingViewModel.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I cleaned the project and the folders, but no luck. Is there something I need to do manually in the project settings in order to compile? I use Xcode 9