finished converting chapter 7 examples to swift