Implement Stanford iOS assignment by swift