Book Image

Swift Essentials - Second Edition

By : Alex Blewitt
Book Image

Swift Essentials - Second Edition

By: Alex Blewitt

Overview of this book

Swift was considered one of the biggest innovations last year, and certainly with Swift 2 announced at WWDC in 2015, this segment of the developer space will continue to be hot and dominating. This is a fast-paced guide to provide an overview of Swift programming and then walks you through in detail how to write iOS applications. Progress through chapters on custom views, networking, parsing and build a complete application as a Git repository, all by using Swift as the core language
Table of Contents (17 chapters)
Swift Essentials Second Edition
About the Author
About the Reviewer

Responding to user interaction

Typically, a watch user interface will present information to the user or let them select or manipulate it in some way. When items are presented in a table, then it is natural to let the user tap on the row to show a subsequent screen. Watch applications use segues to move from one screen to another in a similar way to iOS applications.

The first step will involve creating a new controller file called RepositoryListController.swift. This will be used to hold the RepositoryListController and RepositoryRowController classes, in a very similar way to the existing InterfaceController. As with the other view, there will be a table to store the rows, and each row will have a name label:

class RepositoryRowController: NSObject {
  @IBOutlet weak var name: WKInterfaceLabel!
class RepositoryListController: WKInterfaceController {
  let delegate = WKExtension.sharedExtension().delegate as! ExtensionDelegate
  @IBOutlet weak var repositoriesTable: WKInterfaceTable!