Skip to content

Commit afac052

Browse files
committed
update for Swift 1.2, Xcode 6.3
1 parent 78b3661 commit afac052

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

bk2ch18p713addressBook/ch31p973addressBook/Images.xcassets/AppIcon.appiconset/Contents.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
"idiom" : "iphone",
1515
"size" : "60x60",
1616
"scale" : "2x"
17+
},
18+
{
19+
"idiom" : "iphone",
20+
"size" : "60x60",
21+
"scale" : "3x"
1722
}
1823
],
1924
"info" : {

bk2ch18p713addressBook/ch31p973addressBook/ViewController.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class ViewController: UIViewController, ABPeoplePickerNavigationControllerDelega
8989
}
9090

9191
var moi : ABRecord! = nil
92-
let matts = ABAddressBookCopyPeopleWithName(self.adbk, "Matt").takeRetainedValue() as NSArray
92+
let matts = ABAddressBookCopyPeopleWithName(self.adbk, "Matt").takeRetainedValue() as [AnyObject]
9393
// could have asked for "Matt Neuburg" but I wanted to show how to cycle thru the results
9494
for matt in matts {
9595
if let last = ABRecordCopyValue(matt, kABPersonLastNameProperty).takeRetainedValue() as? String {
@@ -105,10 +105,10 @@ class ViewController: UIViewController, ABPeoplePickerNavigationControllerDelega
105105
}
106106
// parse my emails
107107
let emails:ABMultiValue = ABRecordCopyValue(
108-
moi, kABPersonEmailProperty).takeRetainedValue() as ABMultiValue
108+
moi, kABPersonEmailProperty).takeRetainedValue()
109109
for ix in 0 ..< ABMultiValueGetCount(emails) {
110110
let label = ABMultiValueCopyLabelAtIndex(emails,ix).takeRetainedValue() as String
111-
let value = ABMultiValueCopyValueAtIndex(emails,ix).takeRetainedValue() as String
111+
let value = ABMultiValueCopyValueAtIndex(emails,ix).takeRetainedValue() as! String
112112
println("I have a \(label) address: \(value)")
113113
}
114114
}
@@ -122,7 +122,7 @@ class ViewController: UIViewController, ABPeoplePickerNavigationControllerDelega
122122
let snidely:ABRecord = ABPersonCreate().takeRetainedValue()
123123
ABRecordSetValue(snidely, kABPersonFirstNameProperty, "Snidely", nil)
124124
ABRecordSetValue(snidely, kABPersonLastNameProperty, "Whiplash", nil)
125-
let addr:ABMutableMultiValue = ABMultiValueCreateMutable(
125+
let addr:ABMultiValue = ABMultiValueCreateMutable(
126126
ABPropertyType(kABStringPropertyType)).takeRetainedValue()
127127
ABMultiValueAddValueAndLabel(addr, "[email protected]", kABHomeLabel, nil)
128128
ABRecordSetValue(snidely, kABPersonEmailProperty, addr, nil)
@@ -160,9 +160,9 @@ class ViewController: UIViewController, ABPeoplePickerNavigationControllerDelega
160160
println("WTF") // shouldn't happen
161161
return
162162
}
163-
let emails : ABMultiValue = ABRecordCopyValue(person, property).takeRetainedValue()
163+
let emails:ABMultiValue = ABRecordCopyValue(person, property).takeRetainedValue()
164164
let ix = ABMultiValueGetIndexForIdentifier(emails, identifier)
165-
let email = ABMultiValueCopyValueAtIndex(emails, ix).takeRetainedValue() as String
165+
let email = ABMultiValueCopyValueAtIndex(emails, ix).takeRetainedValue() as! String
166166
println(email) // do something with the email here
167167
// self.dismissViewControllerAnimated(true, completion: nil)
168168
}
@@ -176,7 +176,7 @@ class ViewController: UIViewController, ABPeoplePickerNavigationControllerDelega
176176
}
177177

178178
let snides = ABAddressBookCopyPeopleWithName(
179-
self.adbk, "Snidely Whiplash").takeRetainedValue() as Array<ABRecord>
179+
self.adbk, "Snidely Whiplash").takeRetainedValue() as [AnyObject]
180180
if snides.count == 0 {
181181
println("no Snidely")
182182
return

0 commit comments

Comments
 (0)