Implementing a network protocol with Swift and snapshot testing

A guy standing next to a beanstalk

In a previous post, I mentioned Beanstalk, a simple and fast work queue. It uses a simple and straightforward protocol, and learning to implement it in Swift has proven to be extremely fun.

Continue reading

Delete Facebook

Delete facebook, a guy sends an obviously fake article to someone who deleted their facebook account

Using Tagged to write safer Swift code

A guy hidden in a repository costume

I recently started a tiny side project that implements the Beanstalk protocol. If you’ve never heard of beanstalkd, it’s a work queue that’s really convenient for simple projects: you post jobs to queues and those jobs are picked up and handled by workers. Each job that you post to a queue has a priority that goes from 0 (urgent) to 4,294,967,295 (not so much). In Swift, this can be represented with a UInt32, but let’s see how we can use Tagged to make it safer and more expressive, starting with an example from a real-world codebase.

Continue reading

Collective Effort

People sending +1 messages to a github issue

It has been three and a half year that I get the occasional notification from GitHub, about someone asking Facebook to add Swift Support to Infer. They grow up so fast!

Writing a commit message with Swift

Git commits characters waiting in line to ride a roller coaster

In a previous blog post, we covered how to define a custom editor to write your commit messages in. The example was deliberately simple and static, but we covered that an editor could be practically anything. Why not create our own editor in Swift then?

Continue reading