RxSwift: Multiple subscribers for a unit of work

December 7, 2018

I've been working on a side project for better CIFilter documentation lately, and I decided this was as good of a time as any to try out RxSwift. We use reactive programming at work, but I haven't really been able to dig into it yet...

Installing Nokogiri from a Gemfile on Mojave

November 13, 2018

Another MacOS and another struggle through installing nokogiri. Most places online recommend using...

How NOT to set nil in UserDefaults

October 21, 2018

To clear a value from UserDefaults, I previously thought it was fine to do something like this:

UserDefaults.standard.set(nil, forKey: "myKey")

Turns out that this works differently in different iOS versions. Starting in iOS 11, setting nil for a key works as I expected.

Casting a pointer to UInt in Swift

October 15, 2018

There are some times in Swift, like when using System Trace, that you want to get the pointer value of an object directly as a UInt (passing the pointer to kdebug_signpost is one). I was surprised at how hard it was to find documentation on how to get a Swift reference’s pointer value as a UInt.

NSObject Equality is Tricky

November 12, 2016

Swift can be tricky sometimes. For example, what does the following print?

class A: NSObject {
  let x: Int

  init(x: Int) {
    self.x = x
  }
}
func ==(left: A, right: A) -> Bool {
  return left.x == right.x
}
print(A(x: 1) == A(x: 1))
print([A(x: 1)] == [A(x: 1)])