SlideShare a Scribd company logo
Learn
watchOS
Programming!
Communication Channel
Google Document for live chat - http://tiny.cc/watchOSTechTalk
Github link for the project - https://github.com/patilsnehal/watchOSTableview
Create watchOS Application with tableview
Create Project
Add tableview
Change the color of the global tint
Change Identifier
Add Group and then labels to it
Change font, alignment etc
Add a watchKit class
ScheduleInterfaceController
Change the class type as ScheduleInterfaceController
Lets do some coding finally :)
Connect table
@IBOutlet var WWCMeetupTable: WKInterfaceTable!
Set up Number of rows
WWCMeetupTable.setNumberOfRows(10, withRowType: "WWCRow");
Hit Run !
MeetupRowController
Change the class type as MeetupRowController
Add meetup.json and meetup.swift (Shared folder)
[
{
"startTime": "10:00 AM",
"endTime": "12:00 PM",
"title": "Python Meetup",
},
{
"startTime": "12:00 PM",
“endTime": "2:00 PM",
"title": "iOS Meetup",
},
{
"startTime": "2:00 PM",
"endTime": "4:00 PM",
"title": "WatchOS Meetup",
},
{
"startTime": "4:00 PM",
"endTime": "6:00 PM",
"title": "Android Meetup",
},
{
"startTime": "6:00 PM",
"endTime": "8:00 PM",
"title": "Java Meetup",
}
]
class Meetup {
let title: String
let starttime: String
let endtime: String
class func allMeetups() -> [Meetup] {
var meetups = [Meetup]()
if let path = NSBundle.mainBundle().pathForResource("Meetup", ofType: "json"),
let data = NSData(contentsOfFile: path) {
do {
let json = try NSJSONSerialization.JSONObjectWithData(data, options:
NSJSONReadingOptions.AllowFragments) as! [Dictionary<String, String>]
for dict in json {
let meetup = Meetup(dictionary: dict)
meetups.append(meetup)
}
} catch {
print(error)
}
}
return meetups
}
init( title: String, starttime: String, endtime: String) {
self.title = title
self.starttime = starttime
self.endtime = endtime
}
convenience init(dictionary: [String: String]) {
let title = dictionary["title"]!
let starttime = dictionary["startTime"]!
let endtime = dictionary["endTime"]!
self.init(title: title, starttime: starttime, endtime: endtime)
Add files and add them to app and extension target
Configure the labels on MeetupRowController
class MeetupRowController: NSObject {
@IBOutlet var timeLabel: WKInterfaceLabel!
@IBOutlet var titleLabel: WKInterfaceLabel!
// 1
var meetup: Meetup? {
// 2 Add a property observer that is triggered whenever the property is set;
didSet {
// 3 Check of meetup is not nil
if let meetup = meetup {
// 4 configure the labels using the relevant properties of meetup
timeLabel.setText(meetup.starttime)
titleLabel.setText(meetup.title)
}
}
}
}
ScheduleInterfaceController
var meetups = Meetup.allMeetups()
override func awakeWithContext(context: AnyObject?) {
super.awakeWithContext(context)
// Set up a Row count
WWCMeetupTable.setNumberOfRows(meetups.count, withRowType: "WWCRow");
// Add data for each row
for index in 0..<WWCMeetupTable.numberOfRows {
if let controller = WWCMeetupTable.rowControllerAtIndex(index) as? MeetupRowController {
controller.meetup = meetups[index]
}
}
}
Hit Run!
Add new Interface controller and add design it.
● Change Identifier and name it
as “Meetup”
● Copy a image called static
maps into the project and
assign it to the image.
● Create a group and add 2
buttons to it - YES & NO
MeetupInterfaceController
class MeetupInterfaceController: WKInterfaceController {
@IBOutlet var timeLabel: WKInterfaceLabel!
@IBOutlet var titleLabel: WKInterfaceLabel!
// 1
var meetup: Meetup? {
// 2
didSet {
// 3
if let meetup = meetup {
// 4
timeLabel.setText("(meetup.starttime) to (meetup.endtime)")
titleLabel.setText(meetup.title)
}
}
}
override func awakeWithContext(context: AnyObject?) {
super.awakeWithContext(context)
if let meetup = context as? Meetup { self.meetup = meetup }
}
}
ScheduleInterfaceController
Add a method didSelectRowAtIndex to push a viewcontroller
override func table(table: WKInterfaceTable, didSelectRowAtIndex rowIndex: Int) {
let meetup = meetups[rowIndex]
presentControllerWithName("Meetup", context: meetup)
}
Hit Run!
Learn watchOS Programming!
Learn watchOS Programming!

More Related Content

PDF
PyParis2017 / Tutorial transcript - Function-as-a-service : a pythonic perspe...
PDF
Grunt.js introduction
PPTX
Delete the branches from remote repositories(GIT)
PPTX
Launching Applications
PDF
funcs, func expressions, closure, returning funcs, recursion, the stack -goph...
PPTX
Retrofit Technology Overview by Cumulations Technologies
PDF
Anaysing your logs with docker and elk
PDF
SwiftyJSON 慘痛經驗
PyParis2017 / Tutorial transcript - Function-as-a-service : a pythonic perspe...
Grunt.js introduction
Delete the branches from remote repositories(GIT)
Launching Applications
funcs, func expressions, closure, returning funcs, recursion, the stack -goph...
Retrofit Technology Overview by Cumulations Technologies
Anaysing your logs with docker and elk
SwiftyJSON 慘痛經驗

What's hot (10)

PDF
Cocoapods sane library management for xcode
PPTX
Monitoring on Kubernetes using prometheus
DOCX
Lettuce example using simple scenario
PDF
Retro vs volley (2)
PDF
Websocket on Rails
PDF
Kotlin workshop
PPT
Evolution of asynchrony in (ASP).NET
PPTX
Asynchronous programming
PPTX
2014 Taverna Tutorial Biodiversity example
PPTX
Advanced guide to Quartz plugin
Cocoapods sane library management for xcode
Monitoring on Kubernetes using prometheus
Lettuce example using simple scenario
Retro vs volley (2)
Websocket on Rails
Kotlin workshop
Evolution of asynchrony in (ASP).NET
Asynchronous programming
2014 Taverna Tutorial Biodiversity example
Advanced guide to Quartz plugin
Ad

Viewers also liked (10)

PPTX
Apple - what's new in iOS 10, watchOS 3 & tvOS 10
PDF
Dependent things dependency management for apple sw - slideshare
PPTX
Apple Watch Technology & WatchOS 2
PDF
[CocoaHeads Tricity] watchOS 2 - native apps are coming
PDF
watchOS 2でゲーム作ってみた話
PPTX
Transfer data from iPhone to iWatch
PDF
C language in our world 2016
PDF
Apple watch course
PDF
D2 OPEN SEMINAR - WWDC 핫 이슈
PDF
Development of Mobile Applications
Apple - what's new in iOS 10, watchOS 3 & tvOS 10
Dependent things dependency management for apple sw - slideshare
Apple Watch Technology & WatchOS 2
[CocoaHeads Tricity] watchOS 2 - native apps are coming
watchOS 2でゲーム作ってみた話
Transfer data from iPhone to iWatch
C language in our world 2016
Apple watch course
D2 OPEN SEMINAR - WWDC 핫 이슈
Development of Mobile Applications
Ad

Similar to Learn watchOS Programming! (11)

PDF
WatchOS2
PPTX
DevBy. Apple Watch Kit 1.0 (RU) & NFC
PPTX
Apple Watch and WatchKit - A Technical Overview
PDF
Building apps for Apple Watch
PDF
Watch os 2.0
PDF
Build apps for Apple Watch
PDF
Build Apps for Apple Watch - Francesco Novelli - Codemotion Milan 2016
PPTX
Apple Watch Human Interface Guidelines
PDF
Cotap Tech Talks: Roderic Campbell, Minority Report UX with an Apple Watch
PDF
Alberto Guarino "When iPhones and Wearables Dance the Bluetooth Dance: Lesson...
PDF
Writing Your App Swiftly
WatchOS2
DevBy. Apple Watch Kit 1.0 (RU) & NFC
Apple Watch and WatchKit - A Technical Overview
Building apps for Apple Watch
Watch os 2.0
Build apps for Apple Watch
Build Apps for Apple Watch - Francesco Novelli - Codemotion Milan 2016
Apple Watch Human Interface Guidelines
Cotap Tech Talks: Roderic Campbell, Minority Report UX with an Apple Watch
Alberto Guarino "When iPhones and Wearables Dance the Bluetooth Dance: Lesson...
Writing Your App Swiftly

Recently uploaded (20)

PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
UNIT 4 Total Quality Management .pptx
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
Current and future trends in Computer Vision.pptx
PPTX
web development for engineering and engineering
PPTX
additive manufacturing of ss316l using mig welding
PPT
introduction to datamining and warehousing
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
Construction Project Organization Group 2.pptx
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PDF
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
Artificial Intelligence
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
UNIT 4 Total Quality Management .pptx
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Embodied AI: Ushering in the Next Era of Intelligent Systems
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
CYBER-CRIMES AND SECURITY A guide to understanding
Current and future trends in Computer Vision.pptx
web development for engineering and engineering
additive manufacturing of ss316l using mig welding
introduction to datamining and warehousing
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
R24 SURVEYING LAB MANUAL for civil enggi
Construction Project Organization Group 2.pptx
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Artificial Intelligence

Learn watchOS Programming!

  • 2. Communication Channel Google Document for live chat - http://tiny.cc/watchOSTechTalk Github link for the project - https://github.com/patilsnehal/watchOSTableview
  • 3. Create watchOS Application with tableview
  • 6. Change the color of the global tint
  • 8. Add Group and then labels to it
  • 10. Add a watchKit class
  • 12. Change the class type as ScheduleInterfaceController
  • 13. Lets do some coding finally :) Connect table @IBOutlet var WWCMeetupTable: WKInterfaceTable! Set up Number of rows WWCMeetupTable.setNumberOfRows(10, withRowType: "WWCRow");
  • 16. Change the class type as MeetupRowController
  • 17. Add meetup.json and meetup.swift (Shared folder) [ { "startTime": "10:00 AM", "endTime": "12:00 PM", "title": "Python Meetup", }, { "startTime": "12:00 PM", “endTime": "2:00 PM", "title": "iOS Meetup", }, { "startTime": "2:00 PM", "endTime": "4:00 PM", "title": "WatchOS Meetup", }, { "startTime": "4:00 PM", "endTime": "6:00 PM", "title": "Android Meetup", }, { "startTime": "6:00 PM", "endTime": "8:00 PM", "title": "Java Meetup", } ] class Meetup { let title: String let starttime: String let endtime: String class func allMeetups() -> [Meetup] { var meetups = [Meetup]() if let path = NSBundle.mainBundle().pathForResource("Meetup", ofType: "json"), let data = NSData(contentsOfFile: path) { do { let json = try NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.AllowFragments) as! [Dictionary<String, String>] for dict in json { let meetup = Meetup(dictionary: dict) meetups.append(meetup) } } catch { print(error) } } return meetups } init( title: String, starttime: String, endtime: String) { self.title = title self.starttime = starttime self.endtime = endtime } convenience init(dictionary: [String: String]) { let title = dictionary["title"]! let starttime = dictionary["startTime"]! let endtime = dictionary["endTime"]! self.init(title: title, starttime: starttime, endtime: endtime)
  • 18. Add files and add them to app and extension target
  • 19. Configure the labels on MeetupRowController class MeetupRowController: NSObject { @IBOutlet var timeLabel: WKInterfaceLabel! @IBOutlet var titleLabel: WKInterfaceLabel! // 1 var meetup: Meetup? { // 2 Add a property observer that is triggered whenever the property is set; didSet { // 3 Check of meetup is not nil if let meetup = meetup { // 4 configure the labels using the relevant properties of meetup timeLabel.setText(meetup.starttime) titleLabel.setText(meetup.title) } } } }
  • 20. ScheduleInterfaceController var meetups = Meetup.allMeetups() override func awakeWithContext(context: AnyObject?) { super.awakeWithContext(context) // Set up a Row count WWCMeetupTable.setNumberOfRows(meetups.count, withRowType: "WWCRow"); // Add data for each row for index in 0..<WWCMeetupTable.numberOfRows { if let controller = WWCMeetupTable.rowControllerAtIndex(index) as? MeetupRowController { controller.meetup = meetups[index] } } }
  • 22. Add new Interface controller and add design it. ● Change Identifier and name it as “Meetup” ● Copy a image called static maps into the project and assign it to the image. ● Create a group and add 2 buttons to it - YES & NO
  • 23. MeetupInterfaceController class MeetupInterfaceController: WKInterfaceController { @IBOutlet var timeLabel: WKInterfaceLabel! @IBOutlet var titleLabel: WKInterfaceLabel! // 1 var meetup: Meetup? { // 2 didSet { // 3 if let meetup = meetup { // 4 timeLabel.setText("(meetup.starttime) to (meetup.endtime)") titleLabel.setText(meetup.title) } } } override func awakeWithContext(context: AnyObject?) { super.awakeWithContext(context) if let meetup = context as? Meetup { self.meetup = meetup } } }
  • 24. ScheduleInterfaceController Add a method didSelectRowAtIndex to push a viewcontroller override func table(table: WKInterfaceTable, didSelectRowAtIndex rowIndex: Int) { let meetup = meetups[rowIndex] presentControllerWithName("Meetup", context: meetup) }