watchkit Making a simple "Hello, World!" app

Example

Each watchOS target includes an App and an Extension. App contains the UI stuff and Extension contains the actual logic (similar to Views and Models in MVC architecture in iOS).

Each WatchKit App has a Interface.storyboard file which you design the app in it, and a Assets.xcassets file to put your assets in.

Each WatchKit Extension has a InterfaceController.swift file (actually a WKInterfaceController subclass) which is similar to the ViewController file in iOS.

To make a Hello World app:

  1. Open up the Interface.storyboard.

  2. Locate the main InterfaceController.

Locate the main InterfaceController.

  1. From the library in the right pane, add a WKInterfaceLabel.

From the library in the right pane, add a WKInterfaceLabel.

  1. Drag the label and set its text in the right pane to "Hello, World!".

Drag the label and set its text in the right pane to "Hello, World!".

  1. Select the correct scheme (according to the next picture), then run the project by either tapping the run button in the top bar, using Product menu, pressing Cmd-R or tapping run in the Touch Bar.

enter image description here

enter image description here

enter image description here

enter image description here

Apple Watch simulator will eventually show up with your app running.