Core Graphics Tutorial Part 2: Gradients and Contexts

Just to make things easier for people in the future, in Swift 3 you can get the day of the week in much simpler way. Instead of all the dateFormatter and Calendar lines at the beginning of that section you can use the following single line.

var weekday = Calendar.current.component(.weekday, from: Date())

1 Like