These challenges come from Paul Hudson's excellent book Swift Coding Challenges. Check out his book for hints, solutions, and further details about the challenges. Also check out his other books at hackingwithswift.com
iOS 10.0 or later; Swift Playgrounds 1.0 or later