Dial clock
Time for the first clock. No pun intended.
We'll start with a figure that shows how our finished clock view will look:
The outer, thinner arc will display minutes and the inner arc will display hours, so the preceding figure is showing the time to be 08:22.
Note
I guess this is a clock for those who don't need to be too fussy about the exact time.
In this view, we will not use Core Graphics code directly; rather, we will use AppKit's wrapper functions, which simplify much of the drawing code to a set of standard calls with standard default values.
Note
Don't worry; in the next section we'll be getting our hands dirty with direct Core Graphics manipulation.
Creating a custom view with AppKit
The first thing we need to do is create a class and make the custom view an instance of that:
- Create a new Cocoa class file, name it
DialClockView
, and make it a subclass ofNSView
. - This will give you a stub implementation of the
DialClockView
class in a file namedDialClockView.swift.
- In Interface Builder...