Skip to content

Commit

Permalink
Apple Watch and iOS Map Engaged
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-headspace committed Nov 25, 2018
1 parent 86e49fb commit 9109e33
Show file tree
Hide file tree
Showing 15 changed files with 93 additions and 7 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Musgravite/Controller/DetailViewController.swift"
timestampString = "564864561.821962"
timestampString = "564866494.833429"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "195"
Expand Down Expand Up @@ -42,7 +42,7 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Musgravite/Controller/DetailViewController.swift"
timestampString = "564864561.822165"
timestampString = "564866494.8340271"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "196"
Expand Down
4 changes: 2 additions & 2 deletions Musgravite/Controller/DetailViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class DetailViewController: UIViewController, UICollectionViewDelegate, UICollec

func displayMapDirections(){
let sourceCoordinates = locationManager.location?.coordinate
let destinationCoordinates = CLLocationCoordinate2D(latitude: 19.2833333, longitude: -99.1352777777779)
let destinationCoordinates = CLLocationCoordinate2D(latitude: (labInformation?["coordinates"].arrayValue[0].doubleValue)!, longitude: (labInformation?["coordinates"].arrayValue[1].doubleValue)!)
let sourcePlacemark = MKPlacemark(coordinate: sourceCoordinates!)
let destinationPlacemark = MKPlacemark(coordinate: destinationCoordinates)
let sourceItem = MKMapItem(placemark: sourcePlacemark)
Expand Down Expand Up @@ -116,7 +116,7 @@ class DetailViewController: UIViewController, UICollectionViewDelegate, UICollec

@IBAction func sendToAppleMaps(_ sender: Any) {
let sourceCoordinates = locationManager.location?.coordinate
let destinationCoordinates = CLLocationCoordinate2D(latitude: 19.2833333, longitude: -99.1352777777779)
let destinationCoordinates = CLLocationCoordinate2D(latitude: (labInformation?["coordinates"].arrayValue[0].doubleValue)!, longitude: (labInformation?["coordinates"].arrayValue[1].doubleValue)!)
let directionsURL = "http://maps.apple.com/?saddr=\(sourceCoordinates?.latitude ?? 0),\(sourceCoordinates?.longitude ?? 0)&daddr=\(destinationCoordinates.latitude),\(destinationCoordinates.longitude)"
guard let url = URL(string: directionsURL) else {
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,20 @@
"scale" : "2x",
"screen-width" : "<=145"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">161"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">145"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">183"
}
],
"info" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,20 @@
"scale" : "2x",
"screen-width" : "<=145"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">161"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">145"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">183"
}
],
"info" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,20 @@
"scale" : "2x",
"screen-width" : "<=145"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">161"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">145"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">183"
}
],
"info" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,20 @@
"scale" : "2x",
"screen-width" : "<=145"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">161"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">145"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">183"
}
],
"info" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,20 @@
"scale" : "2x",
"screen-width" : "<=145"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">161"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">145"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">183"
}
],
"info" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,20 @@
"scale" : "2x",
"screen-width" : "<=145"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">161"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">145"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">183"
}
],
"info" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,20 @@
"scale" : "2x",
"screen-width" : "<=145"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">161"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">145"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">183"
}
],
"info" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,20 @@
"scale" : "2x",
"screen-width" : "<=145"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">161"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">145"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">183"
}
],
"info" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class DetailInterfaceController: WKInterfaceController {
labLocationOutlet.setText(lab.ubicacion)
floorLocationOutlet.setText("Piso \(lab.piso)")
/* Map */
let tec=CLLocationCoordinate2D(latitude: 19.283996, longitude: -99.136006)
let tec = CLLocationCoordinate2D(latitude: lab.x, longitude: lab.y)
let region=MKCoordinateRegion(center:tec, span: MKCoordinateSpan(latitudeDelta: 0.005, longitudeDelta: 0.005))
mapOutlet.setRegion(region)
mapOutlet.addAnnotation(tec, with: .purple)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ class LabInterfaceController: WKInterfaceController {
ubicacion: l["ubicacion"].stringValue,
piso: l["piso"].stringValue,
trayectoria: l["trayectoria"].stringValue,
posterImage: l["posterImage"].stringValue
posterImage: l["posterImage"].stringValue,
x : l["coordinates"].arrayValue[0].doubleValue,
y : l["coordinates"].arrayValue[1].doubleValue
)
self.rLabs.append(model)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ class WaitInterfaceController: WKInterfaceController, WCSessionDelegate{
ubicacion: l["ubicacion"].stringValue,
piso: l["piso"].stringValue,
trayectoria: l["trayectoria"].stringValue,
posterImage: l["posterImage"].stringValue
posterImage: l["posterImage"].stringValue,
x : l["coordinates"].arrayValue[0].doubleValue,
y : l["coordinates"].arrayValue[1].doubleValue
)
pushController(withName: "DetailInterfaceController", context: model)
} catch let error {
Expand Down
2 changes: 2 additions & 0 deletions WMusgravite Extension/LabData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ struct LabData {
let piso:String
let trayectoria:String
let posterImage:String
let x:Double
let y:Double
}

0 comments on commit 9109e33

Please sign in to comment.