Chapter 16: Testing with RxTest

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
.subscribe(onNext: {
// 2
result = $0
.disposed(by: disposeBag)

// 3
viewModel.hexString.value = "#ff0000"

// 4
waitForExpectations(timeout: 1.0) { error in
guard error == nil else {

// 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

Hi @tkallioras! Unfortunatly this book and it’s associated project files have not yet been updated to work in Xcode 9.

You will need to continue using Xcode 8.3 until an updated version is released. You can download older versions of Xcode from

Hope that helps! :slight_smile:

I was able to resolve the same problem by integrating RxSwift framework with Carthage.

Another option is to add Rx* frameworks to “Link Binary With Libraries” build phase for TestingTests project.

1 Like

This topic was automatically closed after 166 days. New replies are no longer allowed.