Please help with example code compiler error

I'm trying to work through this blog post:

Unfortunately I can't get the code to compile. Not sure if I've copy/pasted something incorrectly, if the compiler has changed, or if it didn't work in the first place. I'm seeing compile error on line 249 of this gist, you should be able to just paste into Xcode to see error.

The error happens when trying to compare the Any value of an evaluated PartialKeyPath with a Primitive value. I can see I think why that's not possible, but I'm unsure how to fix the problem or why it might have worked before.

Any thoughts?


Here's the needed sample code that I was missing: