In addition to using traditional debugging techniques, RxSwift also provides a couple of useful utilities to debug Observable sequences. To demonstrate this, we have created a starter project and initialized a helper class to declare the following two methods, as follows:
public func exampleOf(description: String, actionToPerform: () -> Void) {
print(" ===> Example of:", description, "===>")
actionToPerform()
}
public func delayInExecution(_ delayInterval: TimeInterval, actionToPerform: @escaping () -> Void) {
DispatchQueue.main.asyncAfter(deadline: .now() + delayInterval) {
actionToPerform()
}
}
The delayInExecution() wraps a DispatchQueue to execute an action asynchronously after a delay. As we are working with asynchronous code, we have also imported PlaygroundSupport and set needsIndefiniteExecution...