diff --git a/VIPER-SWIFT/Classes/Common/Categories/NSCalendar+CalendarAdditions.swift b/VIPER-SWIFT/Classes/Common/Categories/NSCalendar+CalendarAdditions.swift index 316fd4c..993a6dd 100755 --- a/VIPER-SWIFT/Classes/Common/Categories/NSCalendar+CalendarAdditions.swift +++ b/VIPER-SWIFT/Classes/Common/Categories/NSCalendar+CalendarAdditions.swift @@ -61,7 +61,7 @@ extension NSCalendar { func dateForEndOfFollowingWeekWithDate(date: NSDate) -> NSDate { let endOfWeek = dateForEndOfWeekWithDate(date) let nextWeekComponent = NSDateComponents() - nextWeekComponent.setWeek(1) + nextWeekComponent.weekOfYear = 1 let followingWeekDate = dateByAddingComponents(nextWeekComponent, toDate: endOfWeek, options: nil) return followingWeekDate } @@ -79,17 +79,17 @@ extension NSCalendar { } func isDate(date: NSDate, duringSameWeekAsDate: NSDate) -> Bool { - let dateComponents = components(NSCalendarUnit.WeekCalendarUnit, fromDate: date) - let duringSameWeekComponents = components(NSCalendarUnit.WeekCalendarUnit, fromDate: duringSameWeekAsDate) - let result = dateComponents.week() == duringSameWeekComponents.week() + let dateComponents = components(NSCalendarUnit.WeekOfYearCalendarUnit, fromDate: date) + let duringSameWeekComponents = components(NSCalendarUnit.WeekOfYearCalendarUnit, fromDate: duringSameWeekAsDate) + let result = dateComponents.weekOfYear == duringSameWeekComponents.weekOfYear return result } func isDate(date: NSDate, duringWeekAfterDate: NSDate) -> Bool { let nextWeek = dateForEndOfFollowingWeekWithDate(duringWeekAfterDate) - let dateComponents = components(NSCalendarUnit.WeekCalendarUnit, fromDate: date) - let nextWeekComponents = components(NSCalendarUnit.WeekCalendarUnit, fromDate: nextWeek) - let result = dateComponents.week() == nextWeekComponents.week() + let dateComponents = components(NSCalendarUnit.WeekOfYearCalendarUnit, fromDate: date) + let nextWeekComponents = components(NSCalendarUnit.WeekOfYearCalendarUnit, fromDate: nextWeek) + let result = dateComponents.weekOfYear == nextWeekComponents.weekOfYear return result } diff --git a/VIPER-SWIFT/Classes/Common/Store/CoreDataStore.swift b/VIPER-SWIFT/Classes/Common/Store/CoreDataStore.swift index 0921a62..3b0c1aa 100755 --- a/VIPER-SWIFT/Classes/Common/Store/CoreDataStore.swift +++ b/VIPER-SWIFT/Classes/Common/Store/CoreDataStore.swift @@ -23,7 +23,7 @@ class CoreDataStore : NSObject { var managedObjectModel : NSManagedObjectModel? var managedObjectContext : NSManagedObjectContext? - init() { + override init() { managedObjectModel = NSManagedObjectModel.mergedModelFromBundles(nil) persistentStoreCoordinator = NSPersistentStoreCoordinator(managedObjectModel: managedObjectModel) @@ -46,14 +46,14 @@ class CoreDataStore : NSObject { super.init() } - func fetchEntriesWithPredicate(predicate: NSPredicate, sortDescriptors: AnyObject[], completionBlock: ((ManagedTodoItem[]) -> Void)!) { + func fetchEntriesWithPredicate(predicate: NSPredicate, sortDescriptors: [AnyObject], completionBlock: (([ManagedTodoItem]) -> Void)!) { let fetchRequest = NSFetchRequest(entityName: "TodoItem") fetchRequest.predicate = predicate fetchRequest.sortDescriptors = [] managedObjectContext?.performBlock { let queryResults = self.managedObjectContext?.executeFetchRequest(fetchRequest, error: nil) - let managedResults = queryResults! as ManagedTodoItem[] + let managedResults = queryResults! as [ManagedTodoItem] completionBlock(managedResults) } } diff --git a/VIPER-SWIFT/Classes/Modules/Add/Application Logic/Manager/AddDataManager.swift b/VIPER-SWIFT/Classes/Modules/Add/Application Logic/Manager/AddDataManager.swift index fadd6d8..81153a0 100755 --- a/VIPER-SWIFT/Classes/Modules/Add/Application Logic/Manager/AddDataManager.swift +++ b/VIPER-SWIFT/Classes/Modules/Add/Application Logic/Manager/AddDataManager.swift @@ -12,7 +12,7 @@ class AddDataManager : NSObject { var dataStore : CoreDataStore? func addNewEntry(entry: TodoItem) { - let newEntry = dataStore?.newTodoItem() as ManagedTodoItem + let newEntry = dataStore?.newTodoItem() as ManagedTodoItem! newEntry.name = entry.name newEntry.date = entry.dueDate; diff --git a/VIPER-SWIFT/Classes/Modules/Add/User Interface/View/AddViewController.swift b/VIPER-SWIFT/Classes/Modules/Add/User Interface/View/AddViewController.swift index ec50fdc..8c04db3 100755 --- a/VIPER-SWIFT/Classes/Modules/Add/User Interface/View/AddViewController.swift +++ b/VIPER-SWIFT/Classes/Modules/Add/User Interface/View/AddViewController.swift @@ -12,7 +12,7 @@ import UIKit class AddViewController: UIViewController, UITextFieldDelegate, AddViewInterface { var eventHandler : AddModuleInterface? - @IBOutlet var nameTextField : UITextField + @IBOutlet var nameTextField : UITextField! @IBOutlet var datePicker : UIDatePicker? var minimumDate : NSDate = NSDate() diff --git a/VIPER-SWIFT/Classes/Modules/List/Application Logic/Interactor/ListInteractor.swift b/VIPER-SWIFT/Classes/Modules/List/Application Logic/Interactor/ListInteractor.swift index f3b38d3..b3d9744 100755 --- a/VIPER-SWIFT/Classes/Modules/List/Application Logic/Interactor/ListInteractor.swift +++ b/VIPER-SWIFT/Classes/Modules/List/Application Logic/Interactor/ListInteractor.swift @@ -31,10 +31,10 @@ class ListInteractor : NSObject, ListInteractorInput { }) } - func upcomingItemsFromToDoItems(todoItems: TodoItem[]) -> UpcomingItem[] { + func upcomingItemsFromToDoItems(todoItems: [TodoItem]) -> [UpcomingItem] { let calendar = NSCalendar.autoupdatingCurrentCalendar() - var upcomingItems : UpcomingItem[] = [] + var upcomingItems : [UpcomingItem] = [] for todoItem in todoItems { var dateRelation = calendar.nearTermRelationForDate(todoItem.dueDate, relativeToToday: clock.today()) diff --git a/VIPER-SWIFT/Classes/Modules/List/Application Logic/Interactor/ListInteractorIO.swift b/VIPER-SWIFT/Classes/Modules/List/Application Logic/Interactor/ListInteractorIO.swift index 6be6403..6114b0a 100755 --- a/VIPER-SWIFT/Classes/Modules/List/Application Logic/Interactor/ListInteractorIO.swift +++ b/VIPER-SWIFT/Classes/Modules/List/Application Logic/Interactor/ListInteractorIO.swift @@ -14,5 +14,5 @@ protocol ListInteractorInput { } protocol ListInteractorOutput { - func foundUpcomingItems(upcomingItems: UpcomingItem[]) + func foundUpcomingItems(upcomingItems: [UpcomingItem]) } diff --git a/VIPER-SWIFT/Classes/Modules/List/Application Logic/Manager/ListDataManager.swift b/VIPER-SWIFT/Classes/Modules/List/Application Logic/Manager/ListDataManager.swift index 546c714..cd5e698 100755 --- a/VIPER-SWIFT/Classes/Modules/List/Application Logic/Manager/ListDataManager.swift +++ b/VIPER-SWIFT/Classes/Modules/List/Application Logic/Manager/ListDataManager.swift @@ -12,7 +12,7 @@ import Foundation class ListDataManager : NSObject { var coreDataStore : CoreDataStore? - func todoItemsBetweenStartDate(startDate: NSDate, endDate: NSDate, completion: ((TodoItem[]) -> Void)!) { + func todoItemsBetweenStartDate(startDate: NSDate, endDate: NSDate, completion: (([TodoItem]) -> Void)!) { let calendar = NSCalendar.autoupdatingCurrentCalendar() let beginning = calendar.dateForBeginningOfDay(startDate) let end = calendar.dateForEndOfDay(endDate) @@ -28,8 +28,8 @@ class ListDataManager : NSObject { }) } - func todoItemsFromDataStoreEntries(entries: ManagedTodoItem[]) -> TodoItem[] { - var todoItems : TodoItem[] = [] + func todoItemsFromDataStoreEntries(entries: [ManagedTodoItem]) -> [TodoItem] { + var todoItems : [TodoItem] = [] for managedTodoItem in entries { let todoItem = TodoItem(dueDate: managedTodoItem.date, name: managedTodoItem.name) diff --git a/VIPER-SWIFT/Classes/Modules/List/User Interface/Presenter/ListPresenter.swift b/VIPER-SWIFT/Classes/Modules/List/User Interface/Presenter/ListPresenter.swift index bd24ab0..5cf947e 100755 --- a/VIPER-SWIFT/Classes/Modules/List/User Interface/Presenter/ListPresenter.swift +++ b/VIPER-SWIFT/Classes/Modules/List/User Interface/Presenter/ListPresenter.swift @@ -18,7 +18,7 @@ class ListPresenter : NSObject, ListInteractorOutput, ListModuleInterface, AddMo listInteractor?.findUpcomingItems() } - func foundUpcomingItems(upcomingItems: UpcomingItem[]) { + func foundUpcomingItems(upcomingItems: [UpcomingItem]) { if upcomingItems.count == 0 { userInterface?.showNoContentMessage() } else { @@ -26,12 +26,12 @@ class ListPresenter : NSObject, ListInteractorOutput, ListModuleInterface, AddMo } } - func updateUserInterfaceWithUpcomingItems(upcomingItems: UpcomingItem[]) { + func updateUserInterfaceWithUpcomingItems(upcomingItems: [UpcomingItem]) { let upcomingDisplayData = upcomingDisplayDataWithItems(upcomingItems) userInterface?.showUpcomingDisplayData(upcomingDisplayData) } - func upcomingDisplayDataWithItems(upcomingItems: UpcomingItem[]) -> UpcomingDisplayData { + func upcomingDisplayDataWithItems(upcomingItems: [UpcomingItem]) -> UpcomingDisplayData { let collection = UpcomingDisplayDataCollection() collection.addUpcomingItems(upcomingItems) return collection.collectedDisplayData() diff --git a/VIPER-SWIFT/Classes/Modules/List/User Interface/Presenter/UpcomingDisplayData.swift b/VIPER-SWIFT/Classes/Modules/List/User Interface/Presenter/UpcomingDisplayData.swift index 9c0a93b..e5f78ac 100755 --- a/VIPER-SWIFT/Classes/Modules/List/User Interface/Presenter/UpcomingDisplayData.swift +++ b/VIPER-SWIFT/Classes/Modules/List/User Interface/Presenter/UpcomingDisplayData.swift @@ -9,11 +9,10 @@ import Foundation struct UpcomingDisplayData : Equatable { - let sections : UpcomingDisplaySection[] = [] + let sections : [UpcomingDisplaySection] = [] - init(sections: UpcomingDisplaySection[]) { + init(sections: [UpcomingDisplaySection]) { self.sections = sections - self.sections.unshare() } } diff --git a/VIPER-SWIFT/Classes/Modules/List/User Interface/Presenter/UpcomingDisplayDataCollection.swift b/VIPER-SWIFT/Classes/Modules/List/User Interface/Presenter/UpcomingDisplayDataCollection.swift index d152667..7bc00a4 100755 --- a/VIPER-SWIFT/Classes/Modules/List/User Interface/Presenter/UpcomingDisplayDataCollection.swift +++ b/VIPER-SWIFT/Classes/Modules/List/User Interface/Presenter/UpcomingDisplayDataCollection.swift @@ -10,13 +10,13 @@ import Foundation class UpcomingDisplayDataCollection { let dayFormatter = NSDateFormatter() - var sections : Dictionary = Dictionary() + var sections : Dictionary = Dictionary() init() { dayFormatter.dateFormat = NSDateFormatter.dateFormatFromTemplate("EEEE", options: 0, locale: NSLocale.autoupdatingCurrentLocale()) } - func addUpcomingItems(upcomingItems: UpcomingItem[]) { + func addUpcomingItems(upcomingItems: [UpcomingItem]) { for upcomingItem in upcomingItems { addUpcomingItem(upcomingItem) } @@ -28,11 +28,11 @@ class UpcomingDisplayDataCollection { } func addDisplayItem(displayItem: UpcomingDisplayItem, dateRelation: NearTermDateRelation) { - if var realSection : UpcomingDisplayItem[] = sections[dateRelation] { + if var realSection : [UpcomingDisplayItem] = sections[dateRelation] { realSection.append(displayItem) sections[dateRelation] = realSection } else { - var newSection : UpcomingDisplayItem[] = [] + var newSection : [UpcomingDisplayItem] = [] newSection.append(displayItem) sections[dateRelation] = newSection } @@ -53,7 +53,7 @@ class UpcomingDisplayDataCollection { } func collectedDisplayData() -> UpcomingDisplayData { - let collectedSections : UpcomingDisplaySection[] = sortedUpcomingDisplaySections() + let collectedSections : [UpcomingDisplaySection] = sortedUpcomingDisplaySections() return UpcomingDisplayData(sections: collectedSections) } @@ -65,14 +65,14 @@ class UpcomingDisplayDataCollection { return UpcomingDisplaySection(name: sectionTitle, imageName: imageName, items: items) } - func sortedUpcomingDisplaySections() -> UpcomingDisplaySection[] { + func sortedUpcomingDisplaySections() -> [UpcomingDisplaySection] { let keys = sortedNearTermDateRelations() - var displaySections : UpcomingDisplaySection[] = [] + var displaySections : [UpcomingDisplaySection] = [] for dateRelation in keys { var itemArray = sections[dateRelation] - - if itemArray { + + if itemArray != nil { var displaySection = displaySectionForDateRelation(dateRelation) displaySections.insert(displaySection, atIndex: displaySections.endIndex) } @@ -81,8 +81,8 @@ class UpcomingDisplayDataCollection { return displaySections } - func sortedNearTermDateRelations() -> NearTermDateRelation[] { - var array : NearTermDateRelation[] = [] + func sortedNearTermDateRelations() -> [NearTermDateRelation] { + var array : [NearTermDateRelation] = [] array.insert(NearTermDateRelation.Today, atIndex: 0) array.insert(NearTermDateRelation.Tomorrow, atIndex: 1) array.insert(NearTermDateRelation.LaterThisWeek, atIndex: 2) diff --git a/VIPER-SWIFT/Classes/Modules/List/User Interface/Presenter/UpcomingDisplaySection.swift b/VIPER-SWIFT/Classes/Modules/List/User Interface/Presenter/UpcomingDisplaySection.swift index 5164a31..20ee08c 100755 --- a/VIPER-SWIFT/Classes/Modules/List/User Interface/Presenter/UpcomingDisplaySection.swift +++ b/VIPER-SWIFT/Classes/Modules/List/User Interface/Presenter/UpcomingDisplaySection.swift @@ -12,15 +12,14 @@ import Foundation struct UpcomingDisplaySection : Equatable { let name : String = "" let imageName : String = "" - var items : UpcomingDisplayItem[] = [] + var items : [UpcomingDisplayItem] = [] - init(name: String, imageName: String, items: UpcomingDisplayItem[]?) { + init(name: String, imageName: String, items: [UpcomingDisplayItem]?) { self.name = name self.imageName = imageName - if items { + if items != nil { self.items = items! - self.items.unshare() } } } diff --git a/VIPER-SWIFT/Classes/Modules/List/User Interface/View/ListViewController.swift b/VIPER-SWIFT/Classes/Modules/List/User Interface/View/ListViewController.swift index 954c4bd..0f34bf7 100755 --- a/VIPER-SWIFT/Classes/Modules/List/User Interface/View/ListViewController.swift +++ b/VIPER-SWIFT/Classes/Modules/List/User Interface/View/ListViewController.swift @@ -16,7 +16,7 @@ class ListViewController : UITableViewController, ListViewInterface { var dataProperty : UpcomingDisplayData? var strongTableView : UITableView? - @IBOutlet var noContentView : UIView + @IBOutlet var noContentView : UIView! override func viewDidLoad() { super.viewDidLoad()