Skip to content

Commit 600533d

Browse files
committed
update calendar chapter examples
1 parent b9bdfb6 commit 600533d

File tree

3 files changed

+32
-20
lines changed

3 files changed

+32
-20
lines changed

bk2ch19p725calendar/ch32p986calendar.xcodeproj/project.pbxproj

+13-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 46;
6+
objectVersion = 50;
77
objects = {
88

99
/* Begin PBXBuildFile section */
@@ -101,7 +101,7 @@
101101
};
102102
};
103103
buildConfigurationList = C9C89ADB1829C6DD0073DA93 /* Build configuration list for PBXProject "ch32p986calendar" */;
104-
compatibilityVersion = "Xcode 3.2";
104+
compatibilityVersion = "Xcode 9.3";
105105
developmentRegion = English;
106106
hasScannedForEncodings = 0;
107107
knownRegions = (
@@ -265,9 +265,12 @@
265265
GCC_PRECOMPILE_PREFIX_HEADER = YES;
266266
GCC_PREFIX_HEADER = "ch32p986calendar/ch32p986calendar-Prefix.pch";
267267
INFOPLIST_FILE = "ch32p986calendar/ch32p986calendar-Info.plist";
268-
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
269-
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
270-
ONLY_ACTIVE_ARCH = NO;
268+
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
269+
LD_RUNPATH_SEARCH_PATHS = (
270+
"$(inherited)",
271+
"@executable_path/Frameworks",
272+
);
273+
ONLY_ACTIVE_ARCH = YES;
271274
PRODUCT_BUNDLE_IDENTIFIER = "com.neuburg.matt.${PRODUCT_NAME:rfc1034identifier}";
272275
PRODUCT_MODULE_NAME = MyCalendarApp;
273276
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -287,8 +290,11 @@
287290
GCC_PRECOMPILE_PREFIX_HEADER = YES;
288291
GCC_PREFIX_HEADER = "ch32p986calendar/ch32p986calendar-Prefix.pch";
289292
INFOPLIST_FILE = "ch32p986calendar/ch32p986calendar-Info.plist";
290-
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
291-
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
293+
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
294+
LD_RUNPATH_SEARCH_PATHS = (
295+
"$(inherited)",
296+
"@executable_path/Frameworks",
297+
);
292298
ONLY_ACTIVE_ARCH = NO;
293299
PRODUCT_BUNDLE_IDENTIFIER = "com.neuburg.matt.${PRODUCT_NAME:rfc1034identifier}";
294300
PRODUCT_MODULE_NAME = MyCalendarApp;

bk2ch19p725calendar/ch32p986calendar/ViewController.swift

+6-6
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class ViewController: UIViewController, EKEventViewDelegate, EKEventEditViewDele
7575

7676
func calendar(name:String ) -> EKCalendar? {
7777
let cals = self.database.calendars(for:.event)
78-
return cals.filter {$0.title == name}.first
78+
return cals.first {$0.title == name}
7979
}
8080

8181
@IBAction func createSimpleEvent (_ sender: Any) {
@@ -90,7 +90,7 @@ class ViewController: UIViewController, EKEventViewDelegate, EKEventEditViewDele
9090
}
9191
// form the start and end dates
9292
let greg = Calendar(identifier:.gregorian)
93-
var comp = DateComponents(year:2019, month:8, day:10, hour:15)
93+
var comp = DateComponents(year:2020, month:8, day:10, hour:15)
9494
let d1 = greg.date(from:comp)!
9595
comp.hour = comp.hour! + 1
9696
let d2 = greg.date(from:comp)!
@@ -150,7 +150,7 @@ class ViewController: UIViewController, EKEventViewDelegate, EKEventEditViewDele
150150
ev.calendar = cal
151151
// need a start date and end date
152152
let greg = Calendar(identifier:.gregorian)
153-
var comp = DateComponents(year:2019, month:1, hour:10)
153+
var comp = DateComponents(year:2020, month:1, hour:10)
154154
comp.weekday = 1 // Sunday
155155
comp.weekdayOrdinal = 1 // *first* Sunday
156156
ev.startDate = greg.date(from:comp)!
@@ -259,7 +259,7 @@ class ViewController: UIViewController, EKEventViewDelegate, EKEventEditViewDele
259259
let evc = EKEventEditViewController()
260260
evc.eventStore = self.database
261261
evc.editViewDelegate = self
262-
evc.modalPresentationStyle = .popover
262+
// evc.modalPresentationStyle = .popover
263263
self.present(evc, animated: true)
264264
if let pop = evc.popoverPresentationController {
265265
if let v = sender as? UIView {
@@ -296,7 +296,7 @@ class ViewController: UIViewController, EKEventViewDelegate, EKEventEditViewDele
296296
choo.delegate = self
297297
choo.navigationItem.prompt = "Pick a calendar to delete:"
298298
let nav = UINavigationController(rootViewController: choo)
299-
nav.modalPresentationStyle = .popover
299+
// nav.modalPresentationStyle = .popover
300300
self.present(nav, animated: true)
301301
if let pop = nav.popoverPresentationController {
302302
if let v = sender as? UIView {
@@ -319,7 +319,7 @@ class ViewController: UIViewController, EKEventViewDelegate, EKEventEditViewDele
319319
guard cals.count > 0 else { self.dismiss(animated:true); return }
320320
let calsToDelete = cals.map {$0.calendarIdentifier}
321321
let alert = UIAlertController(title:"Delete selected calendar?",
322-
message:nil, preferredStyle:.actionSheet)
322+
message:nil, preferredStyle:.alert)
323323
alert.addAction(UIAlertAction(title:"Cancel", style:.cancel))
324324
alert.addAction(UIAlertAction(title:"Delete", style:.destructive) {_ in
325325
for id in calsToDelete {

bk2ch19p731reminders/ch32p994reminders.xcodeproj/project.pbxproj

+13-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 46;
6+
objectVersion = 50;
77
objects = {
88

99
/* Begin PBXBuildFile section */
@@ -101,7 +101,7 @@
101101
};
102102
};
103103
buildConfigurationList = C9C89B1C182A9AAE0073DA93 /* Build configuration list for PBXProject "ch32p994reminders" */;
104-
compatibilityVersion = "Xcode 3.2";
104+
compatibilityVersion = "Xcode 9.3";
105105
developmentRegion = English;
106106
hasScannedForEncodings = 0;
107107
knownRegions = (
@@ -265,9 +265,12 @@
265265
GCC_PRECOMPILE_PREFIX_HEADER = YES;
266266
GCC_PREFIX_HEADER = "ch32p994reminders/ch32p994reminders-Prefix.pch";
267267
INFOPLIST_FILE = "ch32p994reminders/ch32p994reminders-Info.plist";
268-
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
269-
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
270-
ONLY_ACTIVE_ARCH = NO;
268+
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
269+
LD_RUNPATH_SEARCH_PATHS = (
270+
"$(inherited)",
271+
"@executable_path/Frameworks",
272+
);
273+
ONLY_ACTIVE_ARCH = YES;
271274
PRODUCT_BUNDLE_IDENTIFIER = "com.neuburg.matt.${PRODUCT_NAME:rfc1034identifier}";
272275
PRODUCT_MODULE_NAME = MyReminderApp;
273276
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -286,8 +289,11 @@
286289
GCC_PRECOMPILE_PREFIX_HEADER = YES;
287290
GCC_PREFIX_HEADER = "ch32p994reminders/ch32p994reminders-Prefix.pch";
288291
INFOPLIST_FILE = "ch32p994reminders/ch32p994reminders-Info.plist";
289-
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
290-
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
292+
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
293+
LD_RUNPATH_SEARCH_PATHS = (
294+
"$(inherited)",
295+
"@executable_path/Frameworks",
296+
);
291297
ONLY_ACTIVE_ARCH = NO;
292298
PRODUCT_BUNDLE_IDENTIFIER = "com.neuburg.matt.${PRODUCT_NAME:rfc1034identifier}";
293299
PRODUCT_MODULE_NAME = MyReminderApp;

0 commit comments

Comments
 (0)