Skip to content

Commit

Permalink
d38 → Swift 1.2 (code)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Davies committed Feb 18, 2015
1 parent 093b209 commit 35e2c32
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions 38-handoff/MapOff/MapOff/Base.lproj/LaunchScreen.xib
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6214" systemVersion="14A314h" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7515.2" systemVersion="14C109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6207"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7512"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
</dependencies>
<objects>
Expand Down
4 changes: 2 additions & 2 deletions 38-handoff/MapOff/MapOff/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6250" systemVersion="14B17" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7515.2" systemVersion="14C109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6244"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7512"/>
</dependencies>
<scenes>
<!--View Controller-->
Expand Down
6 changes: 4 additions & 2 deletions 38-handoff/MapOff/MapOff/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,16 @@ class ViewController: UIViewController, MKMapViewDelegate {

// MARK:- UIResponder Activity Handling
override func updateUserActivityState(activity: NSUserActivity) {
let regionData = NSData(bytes: &mapView.region, length: sizeof(MKCoordinateRegion))
let regionData = withUnsafePointer(&mapView.region) {
NSData(bytes: $0, length: sizeof(MKCoordinateRegion))
}
activity.userInfo = ["region" : regionData]
}

override func restoreUserActivityState(activity: NSUserActivity) {
if activity.activityType == activityType {
// Extract the data
let regionData = activity.userInfo!["region"] as NSData
let regionData = activity.userInfo!["region"] as! NSData
// Need an empty coordinate region to populate
var region = MKCoordinateRegion(center: CLLocationCoordinate2D(latitude: 0.0, longitude: 0.0),
span: MKCoordinateSpan(latitudeDelta: 0.0, longitudeDelta: 0.0))
Expand Down

0 comments on commit 35e2c32

Please sign in to comment.