finished converting chapter 23 examples to swift