Creating the TouchTracker Application

Now let’s get started with your application. In Xcode, create a new Window-based Application iPhone project and name it TouchTracker.

First, you will need a model object that describes a line. Create a new NSObject and name it Line. In Line.h, declare two CGPoint instance variables and two properties:

#​i​m​p​o​r​t​ ​<​F​o​u​n​d​a​t​i​o​n​/​F​o​u​n​d​a​t​i​o​n​.​h​>​

@​i​n​t​e​r​f​a​c​e​ ​L​i​n​e​ ​:​ ​N​S​O​b​j​e​c​t​ ​{​
 ​ ​ ​ ​C​G​P​o​i​n​t​ ​b​e​g​i​n​;​
 ​ ​ ​ ​C​G​P​o​i​n​t​ ​e​n​d​;​
}​
@​p​r​o​p​e​r​t​y​ ​(​n​o​n​a​t​o​m​i​c​)​ ​C​G​P​o​i​n​t​ ​b​e​g​i​n​;​
@​p​r​o​p​e​r​t​y​ ​(​n​o​n​a​t​o​m​i​c​)​ ​C​G​P​o​i​n​t​ ​e​n​d​;​
@​e​n​d​

In Line.m, synthesize the properties:

#​i​m​p​o​r​t​ ​"​L​i​n​e​.​h​"​ ...

Get iOS Programming: The Big Nerd Ranch Guide, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.