Skip to content

Commit cb7edc9

Browse files
committed
update for 6.1 final
1 parent 70f78e9 commit cb7edc9

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

bk2ch19p725calendar/ch32p986calendar/ViewController.swift

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class ViewController: UIViewController, EKEventViewDelegate, EKEventEditViewDele
2626
case .Authorized:
2727
return true
2828
case .NotDetermined:
29-
database.requestAccessToEntityType(type, completion:nil)
29+
self.database.requestAccessToEntityType(type, completion:{_,_ in})
3030
return false
3131
case .Restricted:
3232
return false
@@ -37,7 +37,7 @@ class ViewController: UIViewController, EKEventViewDelegate, EKEventEditViewDele
3737
alert.addAction(UIAlertAction(title: "No", style: .Cancel, handler: nil))
3838
alert.addAction(UIAlertAction(title: "OK", style: .Default, handler: {
3939
_ in
40-
let url = NSURL(string:UIApplicationOpenSettingsURLString)
40+
let url = NSURL(string:UIApplicationOpenSettingsURLString)!
4141
UIApplication.sharedApplication().openURL(url)
4242
}))
4343
self.presentViewController(alert, animated:true, completion:nil)
@@ -105,7 +105,7 @@ class ViewController: UIViewController, EKEventViewDelegate, EKEventEditViewDele
105105
return
106106
}
107107

108-
let greg = NSCalendar(calendarIdentifier:NSGregorianCalendar)
108+
let greg = NSCalendar(calendarIdentifier:NSGregorianCalendar)!
109109
let comp = NSDateComponents()
110110
comp.year = 2015
111111
comp.month = 8
@@ -164,7 +164,7 @@ class ViewController: UIViewController, EKEventViewDelegate, EKEventEditViewDele
164164
ev.addRecurrenceRule(recur)
165165
ev.calendar = cal
166166
// need a start date and end date
167-
let greg = NSCalendar(calendarIdentifier:NSGregorianCalendar)
167+
let greg = NSCalendar(calendarIdentifier:NSGregorianCalendar)!
168168
let comp = NSDateComponents()
169169
comp.year = 2015
170170
comp.month = 1
@@ -196,7 +196,7 @@ class ViewController: UIViewController, EKEventViewDelegate, EKEventEditViewDele
196196
}
197197

198198
let d1 = NSDate() // today
199-
let greg = NSCalendar(calendarIdentifier:NSGregorianCalendar)
199+
let greg = NSCalendar(calendarIdentifier:NSGregorianCalendar)!
200200
let comp = NSDateComponents()
201201
comp.year = 1 // we're going to add 1 to the year
202202
let d2 = greg.dateByAddingComponents(comp, toDate:d1, options:nil)
@@ -237,7 +237,7 @@ class ViewController: UIViewController, EKEventViewDelegate, EKEventEditViewDele
237237

238238
let evc = EKEventViewController()
239239
evc.event = ev
240-
evc.allowsEditing = true
240+
evc.allowsEditing = false
241241
// evc.delegate = self
242242
// in iOS 8 I see no serious reason to assign a delegate...
243243
// ...unless you want to know what the user did
@@ -251,9 +251,10 @@ class ViewController: UIViewController, EKEventViewDelegate, EKEventEditViewDele
251251
nav.modalPresentationStyle = .Popover
252252
self.presentViewController(nav, animated: true, completion: nil)
253253
if let pop = nav.popoverPresentationController {
254-
let v = sender as UIView
255-
pop.sourceView = v
256-
pop.sourceRect = v.bounds
254+
if let v = sender as? UIView {
255+
pop.sourceView = v
256+
pop.sourceRect = v.bounds
257+
}
257258
}
258259
}
259260
}
@@ -266,7 +267,7 @@ class ViewController: UIViewController, EKEventViewDelegate, EKEventEditViewDele
266267
self.dismissViewControllerAnimated(true, completion: nil)
267268
} else {
268269
// user deleted, pop off nav stack
269-
self.navigationController.popToViewController(self, animated: true)
270+
self.navigationController!.popToViewController(self, animated: true)
270271
}
271272
}
272273

bk2ch19p731reminders/ch32p994reminders/ViewController.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class ViewController: UIViewController {
2424
case .Authorized:
2525
return true
2626
case .NotDetermined:
27-
database.requestAccessToEntityType(type, completion:nil)
27+
database.requestAccessToEntityType(type, completion:{_,_ in})
2828
return false
2929
case .Restricted:
3030
return false
@@ -35,7 +35,7 @@ class ViewController: UIViewController {
3535
alert.addAction(UIAlertAction(title: "No", style: .Cancel, handler: nil))
3636
alert.addAction(UIAlertAction(title: "OK", style: .Default, handler: {
3737
_ in
38-
let url = NSURL(string:UIApplicationOpenSettingsURLString)
38+
let url = NSURL(string:UIApplicationOpenSettingsURLString)!
3939
UIApplication.sharedApplication().openURL(url)
4040
}))
4141
self.presentViewController(alert, animated:true, completion:nil)
@@ -69,7 +69,7 @@ class ViewController: UIViewController {
6969
// reminder can have due date
7070
// let's make it today
7171
let today = NSDate()
72-
let greg = NSCalendar(calendarIdentifier:NSGregorianCalendar)
72+
let greg = NSCalendar(calendarIdentifier:NSGregorianCalendar)!
7373
// day without time means "all day"
7474
let comps : NSCalendarUnit = .YearCalendarUnit | .MonthCalendarUnit | .DayCalendarUnit
7575
// start date not needed on iOS

0 commit comments

Comments
 (0)