In this episode, we continue with the simple app. We present a modal with pages of images and text.

This is a multi-part video tutorial series, so be sure to subscribe to the newsletter to be notified when the next episode releases.

Video Tutorial

Finished Project

or see it on GitHub

Relevant Code

  let features = ["Glances", "Notifications", "Apps"]
  
  @IBAction func browseButtonPressed() {
    let controllers = [String](count: features.count, repeatedValue: "FeatureInterfaceController")
    presentControllerWithNames(controllers, contexts: features)
  }

Tutorial Steps

  1. Add new Interface Controller to your WatchKit App Storyboard

  2. Add new file to your WatchKit Extension for FeatureInterfaceController
  3. Connect the two together by setting the Class in your Storyboard
  4. Add an image and a label to the storyboard interface
  5. Open the assistant editor and create outlets for the two new objects by control-dragging from the storyboard to the code
  6. Add a button to the main interface Controller in the storyboard
  7. Wire that button up to an action in the code
  8. In the action, use the presentControllerWithNames to trigger a modal with pages
  9. In the FeatureInterfaceController set the text and the image in the awakeWithContext function
  10. Don't forget to set the Identifier in your storyboard for the FeatureInterfaceController so that the presentControllerWithNames can refer to it

Hello WatchKit Series