Lightweight reactive coding with Swift & VinceRP

In case you are wondering why this blog is all about reactive, it's just the fact that I'm searching for the best possible way to write code. You are probably ahead of me if you already feel comfy with your current setup - if that's the case please share your story. If you are still looking for the right one, read on to check out my latest discovery.


As you've probably seen in my previous posts I started my journey at Objective-C and ReactiveCocoa after I joined my team a year ago. I was amazed by the power of ReactiveCocoa and the experience of our new way of coding. I learned every single operator, every kind of signal's every possible behavior through using them. It took a lot of time, but in the end I had the well-deserved feeling of wow-I-can-write-reactive-code. As soon as I started to use it with Swift it turned out it's still the great silver bullet if you are looking for one.

Although this time I'm looking for something simpler, I just want to write a showcase app. Should I drop my favorite framework now and start coding imperative again? I was wondering if there's anything I can just pull in and write this simple app without blowing everyones brains off with signals.


So my friend and teammate @bvic23 wrote this reactive framework called VinceRP named after his little son (how lovely is that?). I'm aware that he secretly developed a lot of passion for Scala in the past years, that's the reason why he tried to reform its advantages with our shiny new Swift's amazing features like type inference, generics and operator overloading.

I thought it'd be the best time for giving it a try!


My idea was to create a Mac app which is a real time feed of my pasteboard including text (code), images, URLs with the corresponding graphical representation as the content of the feed. I know there are some apps for the base functionality already, but I missed the visuals, the infinite database and the search feature I'm planning to implement so I started out and hope to finish some weekends later.

It's powered by ❤, Swift, reactive & functional approaches - as much as I use at least.

If you're interested in VinceRP check out the basic example of using the framework, but here's also a sneak peek from my app:

Reactive variables

Just a reactive Array of any type. The type of the reactive values will be determined based on the initial value. It's necessary to provide and it can't be optional, yet.

UIKit/AppKit bindings

Binding UI elements to the reactive variable's values:

Or hiding if there's no item available:

Where * is just a shortcut for value().


Propagate changes and updating the UI accordingly:

Putting values

Push values manually into the reactive variable if some shiny new AppKit classes property is not KVO compliant for example.

from the NSPasteboard docs

Updating the values manually:


To be on the safe side, you can dispatch on your favorite queue.

About & more

If you are wondering what's the magic behind VinceRP, check out its GitHub page, or find Viktor on Twitter.

Show Comments