SWIFT WATCHKIT: Creating a simple Watch App

Currently lots of application build in apple watch.If you are familiar with UITableViewController, you may be delighted to know that WKInterfaceTable is a lot simpler to put together: there are no delegate or data sources involved. It’s a very different experience than the iOS equivalent.  It’s  shrinks to one method the developer need to implement.So here I saws how to simple watch app demo.

Step 1 : Open XCode and create new project.

1

Step 2 : Select Application section into “”watchOS” and select “iOS App with WatchKit App” Now Next.

2

Step 3 : Give project name and the select the Language Swift then give location where you want to save                project.
3

Step 4 : Now,Below is tree structure into your project.

4

In this section what I am doing that is I delete the “sampleWatchList WatchKit App” & “sampleWatchList WatchKit Extension” Delete.

Hence I Look like below structure.
5

Step 5 : Adding new target from File > New > Target And Select “WatchKit App” then Next click.
6

Step 6 : Give the name and active the plugin.
7

8

Now,Project structure look like wise.
9

Note : Both new target’s bundle identifiers are always start with Main iPhone app’s bundle identifier. Please do not edit it manually.  if you are going to edit/change later please check the name in every  *.plist file and also *.entitlements file (if you have added any new capabilities)

Step 7 : Now directly jump into “Interface.storyboard” into ListDisplay Section.10

Note : one more thing that is change background color from the “Color” section In my case I set white color.

Step 8 : Now add Table into controller.
12

Step 9 : Now give reference of the table.
13

Step 10 : Create class for table cell.

Then,Give this reference class into table.
15

Step 11 :  Add label in group of row controller. Create outlet in row class. You can set property of label from Attribute inspector.
16

Step 12 : Now give a name in identifier. This name will be useful for reuse of row in table.
17

Step 13 : Now direct jump for code into “InterfaceController.swift” for add data into table.

Output
demo

Grab the source code.

Leave a Reply

Your email address will not be published. Required fields are marked *



*