diff --git a/Clocker/Panel/ParentPanelController+ModernSlider.swift b/Clocker/Panel/ParentPanelController+ModernSlider.swift index d3f799c..8d6508f 100644 --- a/Clocker/Panel/ParentPanelController+ModernSlider.swift +++ b/Clocker/Panel/ParentPanelController+ModernSlider.swift @@ -1,5 +1,6 @@ // Copyright © 2015 Abhishek Banthia +import AppKit import CoreLoggerKit import Foundation @@ -11,7 +12,9 @@ extension ParentPanelController: NSCollectionViewDataSource { } func collectionView(_ collectionView: NSCollectionView, itemForRepresentedObjectAt indexPath: IndexPath) -> NSCollectionViewItem { - let item = collectionView.makeItem(withIdentifier: TimeMarkerViewItem.reuseIdentifier, for: indexPath) as! TimeMarkerViewItem + guard let item = collectionView.makeItem(withIdentifier: TimeMarkerViewItem.reuseIdentifier, for: indexPath) as? TimeMarkerViewItem else { + return NSCollectionViewItem() + } item.setup(with: indexPath.item) return item } diff --git a/Clocker/Panel/Upcoming Events/UpcomingEventViewItem.swift b/Clocker/Panel/Upcoming Events/UpcomingEventViewItem.swift index 19810f6..450e074 100644 --- a/Clocker/Panel/Upcoming Events/UpcomingEventViewItem.swift +++ b/Clocker/Panel/Upcoming Events/UpcomingEventViewItem.swift @@ -1,5 +1,6 @@ // Copyright © 2015 Abhishek Banthia +import AppKit import Foundation class UpcomingEventViewItem: NSCollectionViewItem { @@ -88,7 +89,7 @@ class UpcomingEventViewItem: NSCollectionViewItem { } func setupEmptyState() { - let subtitle = NSCalendar.autoupdatingCurrent.isDateInWeekend(Date()) ? NSLocalizedString("Happy Weekend.", comment: "Button Title for no upcoming event") : NSLocalizedString("Great going.", comment: "Button Title for no upcoming event") + let subtitle = NSCalendar.autoupdatingCurrent.isDateInWeekend(Date()) ? "Happy Weekend.".localized() : "Great going.".localized() setAlternateState(NSLocalizedString("No upcoming events for today!", comment: "Next Event Label with no upcoming event"), subtitle, diff --git a/Clocker/Panel/Upcoming Events/UpcomingEventsDataSource.swift b/Clocker/Panel/Upcoming Events/UpcomingEventsDataSource.swift index b0df0fe..85ec97f 100644 --- a/Clocker/Panel/Upcoming Events/UpcomingEventsDataSource.swift +++ b/Clocker/Panel/Upcoming Events/UpcomingEventsDataSource.swift @@ -27,7 +27,10 @@ class UpcomingEventsDataSource: NSObject, NSCollectionViewDataSource, NSCollecti } func collectionView(_ collectionView: NSCollectionView, itemForRepresentedObjectAt indexPath: IndexPath) -> NSCollectionViewItem { - let item = collectionView.makeItem(withIdentifier: UpcomingEventViewItem.reuseIdentifier, for: indexPath) as! UpcomingEventViewItem + guard let item = collectionView.makeItem(withIdentifier: UpcomingEventViewItem.reuseIdentifier, for: indexPath) as? UpcomingEventViewItem else { + assertionFailure("Unable to make UpcomingEventViewItem") + return NSCollectionViewItem() + } if eventCenter.calendarAccessNotDetermined() { item.setupUndeterminedState(delegate) return item diff --git a/Clocker/Preferences/Calendar/CalendarViewController.swift b/Clocker/Preferences/Calendar/CalendarViewController.swift index 2571868..5d9b046 100644 --- a/Clocker/Preferences/Calendar/CalendarViewController.swift +++ b/Clocker/Preferences/Calendar/CalendarViewController.swift @@ -117,7 +117,10 @@ class CalendarViewController: ParentViewController { } private func onCalendarAccessDenial() { - informationField.stringValue = "Clocker is more useful when it can display events from your calendars. You can change this setting in System Preferences › Security & Privacy › Privacy.".localized() + informationField.stringValue = """ + Clocker is more useful when it can display events from your calendars. + You can change this setting in System Preferences › Security & Privacy › Privacy. + """.localized() setGrantAccess(title: "Launch Preferences".localized()) // Remove upcoming event view if possible