@lmw41 The Single<String> trait works with the Result<String, Error> enumeration under the hood, so you should use the Result<String, Error>.failure(Error) enumeration case instead of the SingleEvent<String>.error(Error) one to return errors from Single<String> traits in this case like this:
You should also use the Result<String, Error>.failure(Error) enumeration case instead of the SingleEvent<String>.error(Error) one to throw errors from Single<String> traits in your code as follows:
loadText(from: "Copyright")
.subscribe {
switch $0 {
case .success(let string):
print(string)
case .failure(let error):
print(error)
}
}
.disposed(by: disposeBag)
We will definitely fix this in the next edition of the book. Thank you!