converted activity view example from chapter 13 to swift