Rubicon is a set of classes, structures, enums, extensions, tools, and utilities to make Swift development easier, cleaner, and less verbose.
Documentation of the API can be found here: Rubion API
Why the name Rubicon?
To cross the Rubicon is a metaphor which means to take an irrevocable step that commits one to a specific course. When Julius Caesar was about to cross the tiny Rubicon River in 49 B.C.E., he quoted from a play by Menander to say "anerriphtho kybos!" or "let the die be cast" in Greek.
Here's just a few of the places where I've taken advantage of Swift's features.
NSRecursiveLock -> RecursiveLock
Even though they've included a version of NSRecursiveLock in the open source version of Swift I still get nervous that one day all the NS* classes will suddenly disappear. So I created a wrapper around NSRecursiveLock called simply "RecursiveLock". That way if I suddenly have to recreate it at least I won't have to rename it.
Also as part of RecursiveLock I've create a method called:
So that rather than the standard design pattern of:
We can now just do this:
It will even allow returned values and throws.
NSCondition -> Conditional
For the same reasons as above I created a wrapper around NSCondition called simply "Conditional".
Also, along with the "withLock(_:)" method above, I've also included a new method called:
This method takes two enclosures. One to test the condition and the other to execute once the condition is met.
So instead of saying:
You can now simply say this:
So much more clear!
Also, the version of "withLock(_:)" in Conditional calls "signal()" right before it calls "unlock()".