Blog

Uncategorized

Swift Custom Operator Spotlight: Optional Casting

I don't know about you, but I often find myself casting objects in Swift. This used to involve writing code like this: if let myDataSource = tableView.dataSource as? MyDataSource { doSomething(to: myDataSource) } This is especially annoying when I'm using a functional programming style, as that entails writing a lot of functions, and casting parameters… Continue reading Swift Custom Operator Spotlight: Optional Casting

Uncategorized

Swift Custom Operator Spotlight: Optional Unwrapping

How often have you written code like this: var object: MyObject? ... if let unwrapped = object { doSomething(with: unwrapped) } Or, worse, in order to minimize indentation or because you're relying on a library you don't control, how often have you written a function like this: func optionalDoSomething(with myObject: MyObject?) { if let unwrapped… Continue reading Swift Custom Operator Spotlight: Optional Unwrapping

Uncategorized

Quick Swift: Combine (Just the Basics)

There are three things you generally want to do with Combine: publish values, manipulate those values, and receive those values elsewhere. Let's see how we can do each of those. Publishing Values Values are published with, predictably, Publishers. The most common way I see this happen is through @Published fields. So, for instance: class App… Continue reading Quick Swift: Combine (Just the Basics)

Uncategorized

Coronemoting: Remote work during the coronavirus pandemic

Hello! Your company is probably remote now due to coronavirus/COVID-19. As a full time remote worker, I have some advice (and encouragement!). First, though, a caveat. If COVID-19 is causing your first experience with remote, understand that this isn’t normally how things go. This situation sucks, period. Even I'm not getting as much done, simply… Continue reading Coronemoting: Remote work during the coronavirus pandemic

Uncategorized

When did New Yorkers start taking COVID-19 seriously? An analysis based on subway app usage

My company owns a bunch of subway apps, but one of our most popular ones is SUBWAY:NYC. Obviously, this app in particular has seen dramatic decreases in usage as a result of the worldwide pandemic that's hit NYC especially hard. While that's bad for me, I thought it might be interesting to look at the… Continue reading When did New Yorkers start taking COVID-19 seriously? An analysis based on subway app usage

Uncategorized

Coronavirus: a mathematical prediction and what you can do about it

Caveat: I’m not the CDC. I’m just a former math professor who had a long flight last week and wanted to figure out the odds that someone on my plane had coronavirus. That said, the model I describe below is a reasonable approximation of the situation we're in for the time being; that is, unless… Continue reading Coronavirus: a mathematical prediction and what you can do about it