Program the Internet of Things with Swift for iOS by Ahmed Bakir Gheorghe Chesler & Manny Torriente
Author:Ahmed Bakir, Gheorghe Chesler & Manny Torriente
Language: eng
Format: epub
Publisher: Apress, Berkeley, CA
As shown in Figure 8-4, add a label in your storyboard scene, after the time label. Be sure to connect the property via the Connection Inspector in Interface Builder.
Figure 8-4.Adding a label to the storyboard
To perform the weather look-up, you need to provide Weather Underground with a zip code. In the awakeWithContext() method of the class, add a geocoder to convert the location to a place-mark with human-readable attributes (Listing 8-22).
Listing 8-22.Performing a Weather Look-up (LocationInterfaceController.swift)
override func awakeWithContext(context: AnyObject?) {
super.awakeWithContext(context)
// Configure interface objects here.
// Configure interface objects here.
if let locationDict = context as? Dictionary<String, AnyObject> {
if let latitude = locationDict["Latitude"] as? Double {
if let longitude = locationDict["Longitude"] as? Double {
let location = CLLocation(latitude: latitude, longitude: longitude)
let prettyLocation = String(format: "%.2f, %.2f", location.coordinate.latitude, location.coordinate.longitude)
coordinatesLabel?.setText(prettyLocation)
currentLocation = CLLocation(latitude: latitude, longitude: longitude)
locationMap?.addAnnotation(location.coordinate, withPinColor: WKInterfaceMapPinColor.Red)
let mapRegion = MKCoordinateRegionMake(location.coordinate, MKCoordinateSpanMake(0.1, 0.1))
locationMap?.setRegion(mapRegion)
geocodeLocation()
}
}
if let timestamp = locationDict["Timestamp"] as? NSDate {
...
}
}
}
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8315)
Test-Driven Development with Java by Alan Mellor(6856)
Data Augmentation with Python by Duc Haba(6777)
Principles of Data Fabric by Sonia Mezzetta(6518)
Learn Blender Simulations the Right Way by Stephen Pearson(6422)
Microservices with Spring Boot 3 and Spring Cloud by Magnus Larsson(6285)
Hadoop in Practice by Alex Holmes(5967)
Jquery UI in Action : Master the concepts Of Jquery UI: A Step By Step Approach by ANMOL GOYAL(5817)
RPA Solution Architect's Handbook by Sachin Sahgal(5685)
Big Data Analysis with Python by Ivan Marin(5426)
The Infinite Retina by Robert Scoble Irena Cronin(5380)
Life 3.0: Being Human in the Age of Artificial Intelligence by Tegmark Max(5164)
Pretrain Vision and Large Language Models in Python by Emily Webber(4392)
Infrastructure as Code for Beginners by Russ McKendrick(4161)
Functional Programming in JavaScript by Mantyla Dan(4048)
The Age of Surveillance Capitalism by Shoshana Zuboff(3965)
WordPress Plugin Development Cookbook by Yannick Lefebvre(3875)
Embracing Microservices Design by Ovais Mehboob Ahmed Khan Nabil Siddiqui and Timothy Oleson(3674)
Applied Machine Learning for Healthcare and Life Sciences Using AWS by Ujjwal Ratan(3653)
