Making the sample code more Swift.