diff --git a/Common/Collection View/GridCollectionViewLayout.swift b/Common/Collection View/GridCollectionViewLayout.swift index 8b75537..bc4fbba 100644 --- a/Common/Collection View/GridCollectionViewLayout.swift +++ b/Common/Collection View/GridCollectionViewLayout.swift @@ -62,7 +62,7 @@ class GridCollectionViewLayout: UICollectionViewFlowLayout } } - if let maxY = maximumY, minY = minimumY + if let maxY = maximumY, let minY = minimumY { // If attributes.frame.minY is greater than maximumY, then it is a new row // In this case, we need to align all the previous tempLayoutAttributes to the same Y-value diff --git a/Common/Components/LoadImageOperation.swift b/Common/Components/LoadImageOperation.swift index 33f6298..b3e2eef 100644 --- a/Common/Components/LoadImageOperation.swift +++ b/Common/Components/LoadImageOperation.swift @@ -56,7 +56,7 @@ public extension LoadImageOperation let options: NSDictionary = [kCGImageSourceShouldCache as NSString: true] - if let imageSource = CGImageSourceCreateWithURL(self.URL, options), quartzImage = CGImageSourceCreateImageAtIndex(imageSource, 0, options) + if let imageSource = CGImageSourceCreateWithURL(self.URL, options), let quartzImage = CGImageSourceCreateImageAtIndex(imageSource, 0, options) { let loadedImage = UIImage(cgImage: quartzImage) diff --git a/Common/Database/DatabaseManager.swift b/Common/Database/DatabaseManager.swift index b61a083..7da94c6 100644 --- a/Common/Database/DatabaseManager.swift +++ b/Common/Database/DatabaseManager.swift @@ -60,8 +60,9 @@ class DatabaseManager var performingMigration = false - if let sourceMetadata = try? NSPersistentStoreCoordinator.metadataForPersistentStore(ofType: NSSQLiteStoreType, at: storeURL, options: options), - managedObjectModel = self.privateManagedObjectContext.persistentStoreCoordinator?.managedObjectModel + if + let sourceMetadata = try? NSPersistentStoreCoordinator.metadataForPersistentStore(ofType: NSSQLiteStoreType, at: storeURL, options: options), + let managedObjectModel = self.privateManagedObjectContext.persistentStoreCoordinator?.managedObjectModel { performingMigration = !managedObjectModel.isConfiguration(withName: nil, compatibleWithStoreMetadata: sourceMetadata) } @@ -333,7 +334,10 @@ private extension DatabaseManager @objc func managedObjectContextWillSave(_ notification: Notification) { - guard let managedObjectContext = notification.object as? NSManagedObjectContext where managedObjectContext.parent == self.validationManagedObjectContext else { return } + guard + let managedObjectContext = notification.object as? NSManagedObjectContext, + managedObjectContext.parent == self.validationManagedObjectContext + else { return } self.validationManagedObjectContext.performAndWait { self.validateManagedObjectContextSave(managedObjectContext) @@ -342,7 +346,10 @@ private extension DatabaseManager @objc func managedObjectContextDidSave(_ notification: Notification) { - guard let managedObjectContext = notification.object as? NSManagedObjectContext where managedObjectContext.parent == self.validationManagedObjectContext else { return } + guard + let managedObjectContext = notification.object as? NSManagedObjectContext, + managedObjectContext.parent == self.validationManagedObjectContext + else { return } self.save() } diff --git a/Cores/DeltaCore b/Cores/DeltaCore index 790b007..ce0e9ca 160000 --- a/Cores/DeltaCore +++ b/Cores/DeltaCore @@ -1 +1 @@ -Subproject commit 790b007ce329c76783cafe1cd69259b5758186cd +Subproject commit ce0e9ca96363ce5bc9280480d1c06563138df544 diff --git a/Delta/Emulation/GameViewController.swift b/Delta/Emulation/GameViewController.swift index a2d1422..7730610 100644 --- a/Delta/Emulation/GameViewController.swift +++ b/Delta/Emulation/GameViewController.swift @@ -116,7 +116,7 @@ extension GameViewController override func prepare(for segue: UIStoryboardSegue, sender: AnyObject?) { - guard let identifier = segue.identifier where identifier == "pause" else { return } + guard let identifier = segue.identifier, identifier == "pause" else { return } guard let gameController = sender as? GameController else { fatalError("sender for pauseSegue must be the game controller that pressed the Menu button") diff --git a/Delta/Game Selection/GamesViewController.swift b/Delta/Game Selection/GamesViewController.swift index f91a382..5682fe9 100644 --- a/Delta/Game Selection/GamesViewController.swift +++ b/Delta/Game Selection/GamesViewController.swift @@ -137,7 +137,7 @@ private extension GamesViewController { func viewControllerForIndex(_ index: Int) -> GamesCollectionViewController? { - guard let pages = self.fetchedResultsController.sections?.first?.numberOfObjects where pages > 0 else { return nil } + guard let pages = self.fetchedResultsController.sections?.first?.numberOfObjects, pages > 0 else { return nil } // Return nil if only one section, and not asking for the 0th view controller guard !(pages == 1 && index != 0) else { return nil } diff --git a/Delta/Pause Menu/Cheats/CheatTextView.swift b/Delta/Pause Menu/Cheats/CheatTextView.swift index fc5ee26..1b81624 100644 --- a/Delta/Pause Menu/Cheats/CheatTextView.swift +++ b/Delta/Pause Menu/Cheats/CheatTextView.swift @@ -42,7 +42,7 @@ extension CheatTextView { super.layoutSubviews() - if let format = self.cheatFormat, font = self.font + if let format = self.cheatFormat, let font = self.font { let characterWidth = ("A" as NSString).size(attributes: [NSFontAttributeName: font]).width @@ -73,11 +73,11 @@ private extension CheatTextView var string: NSString? = nil scanner.scanCharacters(from: CharacterSet.alphanumerics, into: &string) - guard let scannedString = string where scannedString.length > 0 else { break } + guard let scannedString = string, scannedString.length > 0 else { break } let attributedString = NSMutableAttributedString(string: scannedString as String) - if let prefixString = prefixString where prefixString.length > 0 + if let prefixString = prefixString, prefixString.length > 0 { attributedString.addAttribute(CheatPrefixAttribute, value: prefixString, range: NSRange(location: 0, length: 1)) } diff --git a/Delta/Pause Menu/Cheats/CheatsViewController.swift b/Delta/Pause Menu/Cheats/CheatsViewController.swift index 1b6b03e..550836c 100644 --- a/Delta/Pause Menu/Cheats/CheatsViewController.swift +++ b/Delta/Pause Menu/Cheats/CheatsViewController.swift @@ -95,7 +95,7 @@ private extension CheatsViewController func updateBackgroundView() { - if let fetchedObjects = self.fetchedResultsController.fetchedObjects where fetchedObjects.count > 0 + if let fetchedObjects = self.fetchedResultsController.fetchedObjects, fetchedObjects.count > 0 { self.tableView.separatorStyle = .singleLine self.backgroundView.isHidden = true diff --git a/Delta/Pause Menu/Presentation Controller/PausePresentationController.swift b/Delta/Pause Menu/Presentation Controller/PausePresentationController.swift index cf20162..7bd4d9e 100644 --- a/Delta/Pause Menu/Presentation Controller/PausePresentationController.swift +++ b/Delta/Pause Menu/Presentation Controller/PausePresentationController.swift @@ -32,7 +32,7 @@ class PausePresentationController: UIPresentationController super.init(presentedViewController: presentedViewController, presenting: presentingViewController) - self.contentView = Bundle.main.loadNibNamed("PausePresentationControllerContentView", owner: self, options: nil).first as! UIView + self.contentView = Bundle.main.loadNibNamed("PausePresentationControllerContentView", owner: self, options: nil)?.first as! UIView } override func frameOfPresentedViewInContainerView() -> CGRect @@ -61,7 +61,9 @@ class PausePresentationController: UIPresentationController { self.pauseLabel.text = provider.pauseText } - else if let navigationController = self.presentedViewController as? UINavigationController, provider = navigationController.topViewController as? PauseInfoProviding + else if + let navigationController = self.presentedViewController as? UINavigationController, + let provider = navigationController.topViewController as? PauseInfoProviding { self.pauseLabel.text = provider.pauseText } diff --git a/Delta/Pause Menu/Save States/SaveStatesViewController.swift b/Delta/Pause Menu/Save States/SaveStatesViewController.swift index 2206900..30d9fee 100644 --- a/Delta/Pause Menu/Save States/SaveStatesViewController.swift +++ b/Delta/Pause Menu/Save States/SaveStatesViewController.swift @@ -169,7 +169,7 @@ private extension SaveStatesViewController func updateBackgroundView() { - if let fetchedObjects = self.fetchedResultsController.fetchedObjects where fetchedObjects.count > 0 + if let fetchedObjects = self.fetchedResultsController.fetchedObjects, fetchedObjects.count > 0 { self.backgroundView.isHidden = true } @@ -587,8 +587,8 @@ extension SaveStatesViewController: UIViewControllerPreviewingDelegate, UIPrevie { guard let indexPath = self.collectionView?.indexPathForItem(at: location), - let layoutAttributes = self.collectionViewLayout.layoutAttributesForItem(at: indexPath) - where self.emulatorCoreSaveState != nil + let layoutAttributes = self.collectionViewLayout.layoutAttributesForItem(at: indexPath), + self.emulatorCoreSaveState != nil else { return nil } previewingContext.sourceRect = layoutAttributes.frame diff --git a/Delta/Settings/ControllersSettingsViewController.swift b/Delta/Settings/ControllersSettingsViewController.swift index 2051648..2fd2394 100644 --- a/Delta/Settings/ControllersSettingsViewController.swift +++ b/Delta/Settings/ControllersSettingsViewController.swift @@ -71,7 +71,7 @@ class ControllersSettingsViewController: UITableViewController controllers.append(self.localDeviceController) // Reset previous controller - if let playerIndex = self.playerIndex, index = controllers.index(where: { $0.playerIndex == playerIndex }) + if let playerIndex = self.playerIndex, let index = controllers.index(where: { $0.playerIndex == playerIndex }) { let controller = controllers[index] controller.playerIndex = nil