Skip to content
This repository was archived by the owner on Sep 3, 2018. It is now read-only.

Commit 15bd006

Browse files
committed
Updated for iOS 8.2 beta 2
- `awakeWithContext()` is used for passing data now. - Some methods of `WKInterfaceMap` were renamed.
1 parent 1fd6cce commit 15bd006

5 files changed

Lines changed: 16 additions & 13 deletions

File tree

WatchKit Extension/BaseInterfaceController.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,18 @@
99
import WatchKit
1010

1111
class BaseInterfaceController: WKInterfaceController {
12-
let context:CDAEntry
12+
var context:CDAEntry! = nil
13+
14+
override init!() {
15+
super.init()
16+
}
1317

1418
override func contextForSegueWithIdentifier(identifier: String) -> AnyObject? {
1519
return context
1620
}
1721

18-
override init(context: AnyObject?) {
22+
override func awakeWithContext(context: AnyObject!) {
1923
self.context = context as CDAEntry
20-
super.init(context: context)
2124
}
2225

2326
@IBAction func homeTapped() {

WatchKit Extension/DetailInterfaceController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ class DetailInterfaceController: BaseInterfaceController {
1212
@IBOutlet weak var textLabel: WKInterfaceLabel!
1313
@IBOutlet weak var titleLabel: WKInterfaceLabel!
1414

15-
override init(context: AnyObject?) {
16-
super.init(context: context)
15+
override func awakeWithContext(context: AnyObject!) {
16+
super.awakeWithContext(context);
1717

1818
titleLabel.setText(self.context.fields["nameOfBar"] as? String)
1919

WatchKit Extension/ImageInterfaceController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ class ImageInterfaceController:BaseInterfaceController {
3030
secondImage.startAnimating()
3131
}
3232

33-
override init(context: AnyObject?) {
34-
super.init(context: context)
33+
override func awakeWithContext(context: AnyObject!) {
34+
super.awakeWithContext(context)
3535

3636
if (self.context.fields["images"] == nil) {
3737
return

WatchKit Extension/InterfaceController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ class InterfaceController: WKInterfaceController, CLLocationManagerDelegate {
1919
return newsItems[rowIndex]
2020
}
2121

22-
override init(context: AnyObject?) {
22+
override init!() {
2323
client = CDAClient(spaceKey: "exembnlnz9oo", accessToken: "2ec43b32ffdda511b09abfd6a5b8ff65125cd19a4f6377d6a1e9540d34120052")
2424

25-
super.init(context: context)
25+
super.init()
2626
}
2727

2828
override func willActivate() {

WatchKit Extension/MapInterfaceController.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ import WatchKit
1111
class MapInterfaceController: BaseInterfaceController {
1212
@IBOutlet weak var mapView: WKInterfaceMap!
1313

14-
override init(context: AnyObject?) {
15-
super.init(context: context)
14+
override func awakeWithContext(context: AnyObject!) {
15+
super.awakeWithContext(context)
1616

1717
let coordinateSpan = MKCoordinateSpan(latitudeDelta: 0.005, longitudeDelta: 0.005)
1818
let location = self.context.CLLocationCoordinate2DFromFieldWithIdentifier("location")
1919

2020
mapView.addAnnotation(location, withPinColor: .Red)
21-
mapView.setMapRect(MKMapRect(origin: MKMapPointForCoordinate(location),
21+
mapView.setVisibleMapRect(MKMapRect(origin: MKMapPointForCoordinate(location),
2222
size: MKMapSize(width: 0.5, height: 0.5)))
23-
mapView.setCoordinateRegion(MKCoordinateRegion(center: location, span: coordinateSpan))
23+
mapView.setRegion(MKCoordinateRegion(center: location, span: coordinateSpan))
2424
}
2525
}

0 commit comments

Comments
 (0)