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
Credits
About the Author
Acknowledgments
About the Reviewer
www.PacktPub.com
Preface
Index

Creating watch interfaces


A watch's user interface is built up of elements in a similar way to iOS applications, except that the user toolkit is built using WatchKit instead of UIKit. In the same way that classes, such as UITableView, exist, corresponding classes, such as WKInterfaceTable, also exist. There are minor differences; for example, the UITableView will dynamically populate the elements upon display, but the WKInterfaceTable will expect to be told in advance how many rows exist and what these rows are.

Adding a list of users to the watch

Unlike the UITableView, which provides section headers to group rows, a WKInterfaceTable only permits a single list of items. Instead, the application will be designed so that the first screen will show a list of users, and then the second screen will show the selected user's repositories.

For testing purposes, add the following into the applicationDidFinishLaunching method of the ExtensionDelegate class:

api = GitHubAPI.connect()
addUser("alblue"...