promotion
Powerful debugging in Xcode,
no code changes or 3rd party frameworks required.

Binding a simple list to a UITableView

While still keep improving the current version of CombineDataSources I tought it’d be nice to post few articles on the current API design along with some code samples. This would be nice in order to get some feedback and to try putting some of the code in context. CombineDataSources Introduction RxSwiftCommunity’s excellent RxDataSources allows developers to reactively bind data to table and collection views. It uses a lot of the underlaying structure of RxSwift and it’s very powerful. …

Posted on

An assert operator: assertMaxSubscriptions()

While I keep working on CombineDataSources I’ve faced some of the differences between RxSwift and Combine and those are slowing me down a bit. For example: in RxSwift when dealing with UI I’d usually use shareReplayLatestWhileConnected() - this operator shares an observable and emits the latest value to all subscribers downstream. In Combine there is currently a share() operator which does a similar thing but does not “replay” the latest value. …

Posted on

Debug logging with CombinePrintout

Logging is a really powerful way to debug code, especially if it’s asynchronous code that runs in a time sensitive way so stepping through the debugger is a pain. In Simple custom Combine operators I wrote about how to create an operator that logs to the system Console app in just few lines. After playing with Combine some more I went ahead and created a micro framework called “CombinePrintout” that adds few convenient methods to Combine allowing you to quickly print information about your subscriptions. …

Posted on

Building a custom `sample` operator

In Simple custom Combine operators I spoke about how you can cheaply create your own custom Combine operator without the need to create a new custom Publisher type. In this post I’d like to show how this kind of “cheap” operators could actually be quite complex and useful; still being created only by creatively combining existing operators. Let’s look at sample(_)… The sample operator rxmarbles.com is a marveleous website where you can find visual and interactive presentations of a multitude of reactive operators (based in their implementation in RxJS). …

Posted on

Simple custom Combine operators

Creating simple custom operators is very straightforward in Combine. As long as your custom operator can be expressed via combining existing operators you don’t need to create a new publisher type - you can simply extend the Publisher protocol with your own custom operator. Let’s try quickly creating one now. Extending Publisher You can extend Publisher like any other protocol in Swift. For this post I’ll create a debugging operator that writes logs to the system console. …

Posted on