Manually fixes errors Swift 3 migrator missed
I apologize for any “try!”s that may still remain…
This commit is contained in:
parent
9ce16a2a9d
commit
8b97d1badc
@ -20,7 +20,7 @@ class GameCollectionViewDataSource: NSObject
|
|||||||
|
|
||||||
var cellConfigurationHandler: ((GridCollectionViewCell, Game) -> Void)?
|
var cellConfigurationHandler: ((GridCollectionViewCell, Game) -> Void)?
|
||||||
|
|
||||||
private(set) var fetchedResultsController: NSFetchedResultsController = NSFetchedResultsController()
|
private(set) var fetchedResultsController: NSFetchedResultsController<NSFetchRequestResult> = NSFetchedResultsController<NSFetchRequestResult>()
|
||||||
|
|
||||||
private var prototypeCell = GridCollectionViewCell()
|
private var prototypeCell = GridCollectionViewCell()
|
||||||
|
|
||||||
|
|||||||
@ -25,7 +25,7 @@ public class LoadImageOperation: RSTOperation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public var imageCache: Cache<AnyObject, AnyObject>? {
|
public var imageCache: Cache<NSURL, UIImage>? {
|
||||||
didSet {
|
didSet {
|
||||||
// Ensures if an image is cached, it will be returned immediately, to prevent temporary flash of placeholder image
|
// Ensures if an image is cached, it will be returned immediately, to prevent temporary flash of placeholder image
|
||||||
self.isImmediate = self.imageCache?.object(forKey: self.URL) != nil
|
self.isImmediate = self.imageCache?.object(forKey: self.URL) != nil
|
||||||
@ -48,7 +48,7 @@ public extension LoadImageOperation
|
|||||||
{
|
{
|
||||||
guard !self.isCancelled else { return }
|
guard !self.isCancelled else { return }
|
||||||
|
|
||||||
if let cachedImage = self.imageCache?.object(forKey: self.URL) as? UIImage
|
if let cachedImage = self.imageCache?.object(forKey: self.URL)
|
||||||
{
|
{
|
||||||
self.image = cachedImage
|
self.image = cachedImage
|
||||||
return
|
return
|
||||||
|
|||||||
@ -112,7 +112,7 @@ class DatabaseManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
let game = Game.insertIntoManagedObjectContext(managedObjectContext)
|
let game = Game.insertIntoManagedObjectContext(managedObjectContext)
|
||||||
game.name = try! URL.deletingPathExtension()?.lastPathComponent ?? NSLocalizedString("Game", comment: "")
|
game.name = try! URL.deletingPathExtension().lastPathComponent ?? NSLocalizedString("Game", comment: "")
|
||||||
game.identifier = identifier
|
game.identifier = identifier
|
||||||
game.filename = filename
|
game.filename = filename
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,7 @@ extension Game
|
|||||||
}
|
}
|
||||||
|
|
||||||
@objc(Game)
|
@objc(Game)
|
||||||
class Game: NSManagedObject, GameType
|
class Game: NSManagedObject
|
||||||
{
|
{
|
||||||
@NSManaged var artworkURL: URL?
|
@NSManaged var artworkURL: URL?
|
||||||
@NSManaged var filename: String
|
@NSManaged var filename: String
|
||||||
@ -44,7 +44,7 @@ class Game: NSManagedObject, GameType
|
|||||||
|
|
||||||
var fileURL: URL {
|
var fileURL: URL {
|
||||||
let fileURL = try! DatabaseManager.gamesDirectoryURL.appendingPathComponent(self.filename)
|
let fileURL = try! DatabaseManager.gamesDirectoryURL.appendingPathComponent(self.filename)
|
||||||
return fileURL!
|
return fileURL
|
||||||
}
|
}
|
||||||
|
|
||||||
var preferredFileExtension: String {
|
var preferredFileExtension: String {
|
||||||
@ -58,6 +58,8 @@ class Game: NSManagedObject, GameType
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension Game: GameType {}
|
||||||
|
|
||||||
extension Game
|
extension Game
|
||||||
{
|
{
|
||||||
class func supportedTypeIdentifiers() -> Set<String>
|
class func supportedTypeIdentifiers() -> Set<String>
|
||||||
|
|||||||
@ -26,7 +26,7 @@ extension SaveState
|
|||||||
case previewGame
|
case previewGame
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc enum Type: Int16
|
@objc enum `Type`: Int16
|
||||||
{
|
{
|
||||||
case auto
|
case auto
|
||||||
case general
|
case general
|
||||||
@ -34,6 +34,8 @@ extension SaveState
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@objc(SaveState)
|
@objc(SaveState)
|
||||||
class SaveState: NSManagedObject, SaveStateType
|
class SaveState: NSManagedObject, SaveStateType
|
||||||
{
|
{
|
||||||
|
|||||||
15
Common/Extensions/NSFetchedResultsController+Conveniences.h
Normal file
15
Common/Extensions/NSFetchedResultsController+Conveniences.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
//
|
||||||
|
// NSFetchedResultsController+Conveniences.h
|
||||||
|
// Delta
|
||||||
|
//
|
||||||
|
// Created by Riley Testut on 7/13/16.
|
||||||
|
// Copyright © 2016 Riley Testut. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
@import CoreData;
|
||||||
|
|
||||||
|
@interface NSFetchedResultsController (Conveniences)
|
||||||
|
|
||||||
|
- (void)performFetchIfNeeded;
|
||||||
|
|
||||||
|
@end
|
||||||
31
Common/Extensions/NSFetchedResultsController+Conveniences.m
Normal file
31
Common/Extensions/NSFetchedResultsController+Conveniences.m
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
//
|
||||||
|
// NSFetchedResultsController+Conveniences.m
|
||||||
|
// Delta
|
||||||
|
//
|
||||||
|
// Created by Riley Testut on 7/13/16.
|
||||||
|
// Copyright © 2016 Riley Testut. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "NSFetchedResultsController+Conveniences.h"
|
||||||
|
|
||||||
|
@import Roxas;
|
||||||
|
|
||||||
|
@implementation NSFetchedResultsController (Conveniences)
|
||||||
|
|
||||||
|
// Needs to be implemented in Objective-C due to current limitation of Swift:
|
||||||
|
// Extension of a generic Objective-C class cannot access the class's generic parameters at runtime
|
||||||
|
- (void)performFetchIfNeeded
|
||||||
|
{
|
||||||
|
if (self.fetchedObjects != nil)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSError *error = nil;
|
||||||
|
if (![self performFetch:&error])
|
||||||
|
{
|
||||||
|
ELog(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
@ -1,26 +0,0 @@
|
|||||||
//
|
|
||||||
// NSFetchedResultsController+Conveniences.swift
|
|
||||||
// Delta
|
|
||||||
//
|
|
||||||
// Created by Riley Testut on 5/20/16.
|
|
||||||
// Copyright © 2016 Riley Testut. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
import CoreData
|
|
||||||
|
|
||||||
extension NSFetchedResultsController
|
|
||||||
{
|
|
||||||
func performFetchIfNeeded()
|
|
||||||
{
|
|
||||||
guard self.fetchedObjects == nil else { return }
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
try self.performFetch()
|
|
||||||
}
|
|
||||||
catch let error as NSError
|
|
||||||
{
|
|
||||||
print(error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -28,12 +28,6 @@ extension NSManagedObject
|
|||||||
|
|
||||||
// MARK: - Fetches -
|
// MARK: - Fetches -
|
||||||
|
|
||||||
class func fetchRequest() -> NSFetchRequest<AnyObject>
|
|
||||||
{
|
|
||||||
let fetchRequest = NSFetchRequest(entityName: self.entityName)
|
|
||||||
return fetchRequest
|
|
||||||
}
|
|
||||||
|
|
||||||
class func instancesInManagedObjectContext<T: NSManagedObject>(_ managedObjectContext: NSManagedObjectContext, type: T.Type) -> [T]
|
class func instancesInManagedObjectContext<T: NSManagedObject>(_ managedObjectContext: NSManagedObjectContext, type: T.Type) -> [T]
|
||||||
{
|
{
|
||||||
return self.instancesWithPredicate(nil, inManagedObjectContext: managedObjectContext, type: type)
|
return self.instancesWithPredicate(nil, inManagedObjectContext: managedObjectContext, type: type)
|
||||||
|
|||||||
@ -53,11 +53,11 @@ class GamePickerController: NSObject
|
|||||||
|
|
||||||
let importAction = UIAlertAction(title: NSLocalizedString("Import", comment: ""), style: .default) { action in
|
let importAction = UIAlertAction(title: NSLocalizedString("Import", comment: ""), style: .default) { action in
|
||||||
|
|
||||||
let documentsDirectoryURL = try! DatabaseManager.databaseDirectoryURL.deletingLastPathComponent
|
let documentsDirectoryURL = try! DatabaseManager.databaseDirectoryURL.deletingLastPathComponent()
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
let contents = try FileManager.default.contentsOfDirectory(at: documentsDirectoryURL!, includingPropertiesForKeys: nil, options: .skipsHiddenFiles)
|
let contents = try FileManager.default.contentsOfDirectory(at: documentsDirectoryURL, includingPropertiesForKeys: nil, options: .skipsHiddenFiles)
|
||||||
|
|
||||||
let managedObjectContext = DatabaseManager.sharedManager.backgroundManagedObjectContext()
|
let managedObjectContext = DatabaseManager.sharedManager.backgroundManagedObjectContext()
|
||||||
managedObjectContext.perform() {
|
managedObjectContext.perform() {
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
|
BF02BD001D361BD1000892F2 /* NSFetchedResultsController+Conveniences.m in Sources */ = {isa = PBXBuildFile; fileRef = BF02BCFF1D361BD1000892F2 /* NSFetchedResultsController+Conveniences.m */; };
|
||||||
BF0418141D01E93400E85BCF /* GBADeltaCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF0418131D01E93400E85BCF /* GBADeltaCore.framework */; };
|
BF0418141D01E93400E85BCF /* GBADeltaCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF0418131D01E93400E85BCF /* GBADeltaCore.framework */; };
|
||||||
BF0418151D01E93400E85BCF /* GBADeltaCore.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BF0418131D01E93400E85BCF /* GBADeltaCore.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
BF0418151D01E93400E85BCF /* GBADeltaCore.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BF0418131D01E93400E85BCF /* GBADeltaCore.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||||
BF04A5A31CF8E61C00B4A267 /* UIViewController+PeekPop.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF04A5A21CF8E61C00B4A267 /* UIViewController+PeekPop.swift */; };
|
BF04A5A31CF8E61C00B4A267 /* UIViewController+PeekPop.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF04A5A21CF8E61C00B4A267 /* UIViewController+PeekPop.swift */; };
|
||||||
@ -51,7 +52,6 @@
|
|||||||
BFB141181BE46934004FBF46 /* GameCollectionViewDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFB141171BE46934004FBF46 /* GameCollectionViewDataSource.swift */; };
|
BFB141181BE46934004FBF46 /* GameCollectionViewDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFB141171BE46934004FBF46 /* GameCollectionViewDataSource.swift */; };
|
||||||
BFC2731A1BE6152200D22B05 /* GameCollection.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFC273171BE6152200D22B05 /* GameCollection.swift */; };
|
BFC2731A1BE6152200D22B05 /* GameCollection.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFC273171BE6152200D22B05 /* GameCollection.swift */; };
|
||||||
BFC9B7391CEFCD34008629BB /* CheatsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFC9B7381CEFCD34008629BB /* CheatsViewController.swift */; };
|
BFC9B7391CEFCD34008629BB /* CheatsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFC9B7381CEFCD34008629BB /* CheatsViewController.swift */; };
|
||||||
BFC9B73B1CEFD438008629BB /* NSFetchedResultsController+Conveniences.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFC9B73A1CEFD438008629BB /* NSFetchedResultsController+Conveniences.swift */; };
|
|
||||||
BFDB28451BC9DA7B001D0C83 /* GamePickerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFDB28441BC9DA7B001D0C83 /* GamePickerController.swift */; };
|
BFDB28451BC9DA7B001D0C83 /* GamePickerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFDB28441BC9DA7B001D0C83 /* GamePickerController.swift */; };
|
||||||
BFDE393C1BC0CEDF003F72E8 /* Game.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFDE39391BC0CEDF003F72E8 /* Game.swift */; };
|
BFDE393C1BC0CEDF003F72E8 /* Game.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFDE39391BC0CEDF003F72E8 /* Game.swift */; };
|
||||||
BFE704F51CEA426E0058BAC8 /* Pods.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 22506DA00971C4300AF90A35 /* Pods.framework */; };
|
BFE704F51CEA426E0058BAC8 /* Pods.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 22506DA00971C4300AF90A35 /* Pods.framework */; };
|
||||||
@ -86,6 +86,8 @@
|
|||||||
0340C4EC8B47535482F7F1BB /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = "<group>"; };
|
0340C4EC8B47535482F7F1BB /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = "<group>"; };
|
||||||
22506DA00971C4300AF90A35 /* Pods.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
22506DA00971C4300AF90A35 /* Pods.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
685E0D2F62E4246995A02970 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = "<group>"; };
|
685E0D2F62E4246995A02970 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = "<group>"; };
|
||||||
|
BF02BCFE1D361BD1000892F2 /* NSFetchedResultsController+Conveniences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSFetchedResultsController+Conveniences.h"; sourceTree = "<group>"; };
|
||||||
|
BF02BCFF1D361BD1000892F2 /* NSFetchedResultsController+Conveniences.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSFetchedResultsController+Conveniences.m"; sourceTree = "<group>"; };
|
||||||
BF0418131D01E93400E85BCF /* GBADeltaCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = GBADeltaCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
BF0418131D01E93400E85BCF /* GBADeltaCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = GBADeltaCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
BF04A5A21CF8E61C00B4A267 /* UIViewController+PeekPop.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIViewController+PeekPop.swift"; sourceTree = "<group>"; };
|
BF04A5A21CF8E61C00B4A267 /* UIViewController+PeekPop.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIViewController+PeekPop.swift"; sourceTree = "<group>"; };
|
||||||
BF090CF11B490D8300DCAB45 /* Delta-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Delta-Bridging-Header.h"; sourceTree = "<group>"; };
|
BF090CF11B490D8300DCAB45 /* Delta-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Delta-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||||
@ -131,7 +133,6 @@
|
|||||||
BFC134E01AAD82460087AD7B /* SNESDeltaCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SNESDeltaCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
BFC134E01AAD82460087AD7B /* SNESDeltaCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SNESDeltaCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
BFC273171BE6152200D22B05 /* GameCollection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GameCollection.swift; sourceTree = "<group>"; };
|
BFC273171BE6152200D22B05 /* GameCollection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GameCollection.swift; sourceTree = "<group>"; };
|
||||||
BFC9B7381CEFCD34008629BB /* CheatsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = CheatsViewController.swift; path = "Pause Menu/Cheats/CheatsViewController.swift"; sourceTree = "<group>"; };
|
BFC9B7381CEFCD34008629BB /* CheatsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = CheatsViewController.swift; path = "Pause Menu/Cheats/CheatsViewController.swift"; sourceTree = "<group>"; };
|
||||||
BFC9B73A1CEFD438008629BB /* NSFetchedResultsController+Conveniences.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSFetchedResultsController+Conveniences.swift"; sourceTree = "<group>"; };
|
|
||||||
BFDB28441BC9DA7B001D0C83 /* GamePickerController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GamePickerController.swift; sourceTree = "<group>"; };
|
BFDB28441BC9DA7B001D0C83 /* GamePickerController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GamePickerController.swift; sourceTree = "<group>"; };
|
||||||
BFDE39391BC0CEDF003F72E8 /* Game.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Game.swift; sourceTree = "<group>"; };
|
BFDE39391BC0CEDF003F72E8 /* Game.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Game.swift; sourceTree = "<group>"; };
|
||||||
BFEC732C1AAECC4A00650035 /* Roxas.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Roxas.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
BFEC732C1AAECC4A00650035 /* Roxas.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Roxas.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
@ -247,7 +248,8 @@
|
|||||||
children = (
|
children = (
|
||||||
BF762EAA1BC1B076002C8866 /* NSManagedObject+Conveniences.swift */,
|
BF762EAA1BC1B076002C8866 /* NSManagedObject+Conveniences.swift */,
|
||||||
BF172AEA1C68986300C26774 /* NSManagedObjectContext+Conveniences.swift */,
|
BF172AEA1C68986300C26774 /* NSManagedObjectContext+Conveniences.swift */,
|
||||||
BFC9B73A1CEFD438008629BB /* NSFetchedResultsController+Conveniences.swift */,
|
BF02BCFE1D361BD1000892F2 /* NSFetchedResultsController+Conveniences.h */,
|
||||||
|
BF02BCFF1D361BD1000892F2 /* NSFetchedResultsController+Conveniences.m */,
|
||||||
);
|
);
|
||||||
path = Extensions;
|
path = Extensions;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -558,10 +560,10 @@
|
|||||||
BF762EAB1BC1B076002C8866 /* NSManagedObject+Conveniences.swift in Sources */,
|
BF762EAB1BC1B076002C8866 /* NSManagedObject+Conveniences.swift in Sources */,
|
||||||
BFC9B7391CEFCD34008629BB /* CheatsViewController.swift in Sources */,
|
BFC9B7391CEFCD34008629BB /* CheatsViewController.swift in Sources */,
|
||||||
BF353FFF1C5DA3C500C1184C /* PausePresentationController.swift in Sources */,
|
BF353FFF1C5DA3C500C1184C /* PausePresentationController.swift in Sources */,
|
||||||
|
BF02BD001D361BD1000892F2 /* NSFetchedResultsController+Conveniences.m in Sources */,
|
||||||
BF7AE80A1C2E8C7600B1B5BC /* UIColor+Delta.swift in Sources */,
|
BF7AE80A1C2E8C7600B1B5BC /* UIColor+Delta.swift in Sources */,
|
||||||
BF762E9E1BC19D31002C8866 /* DatabaseManager.swift in Sources */,
|
BF762E9E1BC19D31002C8866 /* DatabaseManager.swift in Sources */,
|
||||||
BF090CF41B490D8300DCAB45 /* UIDevice+Vibration.m in Sources */,
|
BF090CF41B490D8300DCAB45 /* UIDevice+Vibration.m in Sources */,
|
||||||
BFC9B73B1CEFD438008629BB /* NSFetchedResultsController+Conveniences.swift in Sources */,
|
|
||||||
BF797A2D1C2D339F00F1A000 /* UILabel+FontSize.swift in Sources */,
|
BF797A2D1C2D339F00F1A000 /* UILabel+FontSize.swift in Sources */,
|
||||||
BF65E8631CEE5C6A00CD3247 /* Cheat.swift in Sources */,
|
BF65E8631CEE5C6A00CD3247 /* Cheat.swift in Sources */,
|
||||||
BF3540021C5DA3D500C1184C /* PauseStoryboardSegue.swift in Sources */,
|
BF3540021C5DA3D500C1184C /* PauseStoryboardSegue.swift in Sources */,
|
||||||
|
|||||||
@ -22,7 +22,7 @@ private struct DispatchSemaphore: Hashable
|
|||||||
|
|
||||||
init(value: Int)
|
init(value: Int)
|
||||||
{
|
{
|
||||||
self.semaphore = DispatchSemaphore(value: value)
|
self.semaphore = Dispatch.DispatchSemaphore(value: value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,8 +97,8 @@ class EmulationViewController: UIViewController
|
|||||||
|
|
||||||
super.init(coder: aDecoder)
|
super.init(coder: aDecoder)
|
||||||
|
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(EmulationViewController.updateControllers), name: ExternalControllerDidConnectNotification, object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(EmulationViewController.updateControllers), name: NSNotification.Name(rawValue: ExternalControllerDidConnectNotification), object: nil)
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(EmulationViewController.updateControllers), name: ExternalControllerDidDisconnectNotification, object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(EmulationViewController.updateControllers), name: NSNotification.Name(rawValue: ExternalControllerDidDisconnectNotification), object: nil)
|
||||||
|
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(EmulationViewController.willResignActive(_:)), name: NSNotification.Name.UIApplicationWillResignActive, object: UIApplication.shared())
|
NotificationCenter.default.addObserver(self, selector: #selector(EmulationViewController.willResignActive(_:)), name: NSNotification.Name.UIApplicationWillResignActive, object: UIApplication.shared())
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(EmulationViewController.didBecomeActive(_:)), name: NSNotification.Name.UIApplicationDidBecomeActive, object: UIApplication.shared())
|
NotificationCenter.default.addObserver(self, selector: #selector(EmulationViewController.didBecomeActive(_:)), name: NSNotification.Name.UIApplicationDidBecomeActive, object: UIApplication.shared())
|
||||||
@ -250,9 +250,9 @@ class EmulationViewController: UIViewController
|
|||||||
sustainButtonsItem.selected = self.sustainedInputs[ObjectIdentifier(gameController)]?.count > 0
|
sustainButtonsItem.selected = self.sustainedInputs[ObjectIdentifier(gameController)]?.count > 0
|
||||||
|
|
||||||
var fastForwardItem = PauseItem(image: UIImage(named: "FastForward")!, text: NSLocalizedString("Fast Forward", comment: ""), action: { [unowned self] item in
|
var fastForwardItem = PauseItem(image: UIImage(named: "FastForward")!, text: NSLocalizedString("Fast Forward", comment: ""), action: { [unowned self] item in
|
||||||
self.emulatorCore.rate = item.selected ? self.emulatorCore.supportedRates.end : self.emulatorCore.supportedRates.start
|
self.emulatorCore.rate = item.selected ? self.emulatorCore.supportedRates.upperBound : self.emulatorCore.supportedRates.lowerBound
|
||||||
})
|
})
|
||||||
fastForwardItem.selected = self.emulatorCore.rate == self.emulatorCore.supportedRates.start ? false : true
|
fastForwardItem.selected = self.emulatorCore.rate == self.emulatorCore.supportedRates.lowerBound ? false : true
|
||||||
|
|
||||||
pauseViewController.items = [saveStateItem, loadStateItem, cheatCodesItem, fastForwardItem, sustainButtonsItem]
|
pauseViewController.items = [saveStateItem, loadStateItem, cheatCodesItem, fastForwardItem, sustainButtonsItem]
|
||||||
|
|
||||||
@ -512,12 +512,10 @@ extension EmulationViewController: SaveStatesViewControllerDelegate
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let outputImage = self.gameView.outputImage
|
if let outputImage = self.gameView.outputImage, let quartzImage = self.context.createCGImage(outputImage, from: outputImage.extent)
|
||||||
{
|
{
|
||||||
let quartzImage = self.context.createCGImage(outputImage, from: outputImage.extent)
|
|
||||||
|
|
||||||
let image = UIImage(cgImage: quartzImage)
|
let image = UIImage(cgImage: quartzImage)
|
||||||
try? UIImagePNGRepresentation(image)?.write(to: saveState.imageFileURL, options: [.dataWritingAtomic])
|
try! UIImagePNGRepresentation(image)?.write(to: saveState.imageFileURL, options: [.atomicWrite])
|
||||||
}
|
}
|
||||||
|
|
||||||
saveState.modifiedDate = Date()
|
saveState.modifiedDate = Date()
|
||||||
|
|||||||
@ -19,7 +19,7 @@ class GamesViewController: UIViewController
|
|||||||
private var backgroundView: RSTBackgroundView!
|
private var backgroundView: RSTBackgroundView!
|
||||||
private var pageControl: UIPageControl!
|
private var pageControl: UIPageControl!
|
||||||
|
|
||||||
private let fetchedResultsController: NSFetchedResultsController<AnyObject>
|
private let fetchedResultsController: NSFetchedResultsController<NSFetchRequestResult>
|
||||||
|
|
||||||
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
|
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
|
||||||
fatalError("initWithNibName: not implemented")
|
fatalError("initWithNibName: not implemented")
|
||||||
|
|||||||
@ -30,7 +30,7 @@ class CheatsViewController: UITableViewController
|
|||||||
|
|
||||||
private var backgroundView: RSTBackgroundView!
|
private var backgroundView: RSTBackgroundView!
|
||||||
|
|
||||||
private var fetchedResultsController: NSFetchedResultsController<AnyObject>!
|
private var fetchedResultsController: NSFetchedResultsController<NSFetchRequestResult>!
|
||||||
}
|
}
|
||||||
|
|
||||||
extension CheatsViewController
|
extension CheatsViewController
|
||||||
@ -222,7 +222,7 @@ extension CheatsViewController
|
|||||||
{
|
{
|
||||||
let cheat = self.fetchedResultsController.object(at: indexPath) as! Cheat
|
let cheat = self.fetchedResultsController.object(at: indexPath) as! Cheat
|
||||||
|
|
||||||
let deleteAction = UITableViewRowAction(style: UITableViewRowActionStyle(), title: NSLocalizedString("Delete", comment: "")) { (action, indexPath) in
|
let deleteAction = UITableViewRowAction(style: .destructive, title: NSLocalizedString("Delete", comment: "")) { (action, indexPath) in
|
||||||
self.deleteCheat(cheat)
|
self.deleteCheat(cheat)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -51,10 +51,10 @@ class SaveStatesViewController: UICollectionViewController
|
|||||||
private var prototypeCellWidthConstraint: NSLayoutConstraint!
|
private var prototypeCellWidthConstraint: NSLayoutConstraint!
|
||||||
private var prototypeHeader = SaveStatesCollectionHeaderView()
|
private var prototypeHeader = SaveStatesCollectionHeaderView()
|
||||||
|
|
||||||
private var fetchedResultsController: NSFetchedResultsController<AnyObject>!
|
private var fetchedResultsController: NSFetchedResultsController<NSFetchRequestResult>!
|
||||||
|
|
||||||
private let imageOperationQueue = RSTOperationQueue()
|
private let imageOperationQueue = RSTOperationQueue()
|
||||||
private let imageCache = Cache()
|
private let imageCache = Cache<NSURL, UIImage>()
|
||||||
|
|
||||||
private var currentGameState: SaveStateType?
|
private var currentGameState: SaveStateType?
|
||||||
private var selectedSaveState: SaveState?
|
private var selectedSaveState: SaveState?
|
||||||
|
|||||||
@ -14,7 +14,7 @@ class PauseStoryboardSegue: UIStoryboardSegue
|
|||||||
|
|
||||||
override init(identifier: String?, source: UIViewController, destination: UIViewController)
|
override init(identifier: String?, source: UIViewController, destination: UIViewController)
|
||||||
{
|
{
|
||||||
self.presentationController = PausePresentationController(presentedViewController: destination, presentingViewController: source)
|
self.presentationController = PausePresentationController(presentedViewController: destination, presenting: source)
|
||||||
|
|
||||||
super.init(identifier: identifier, source: source, destination: destination)
|
super.init(identifier: identifier, source: source, destination: destination)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,8 +52,8 @@ class ControllersSettingsViewController: UITableViewController
|
|||||||
{
|
{
|
||||||
super.init(coder: aDecoder)
|
super.init(coder: aDecoder)
|
||||||
|
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(ControllersSettingsViewController.externalControllerDidConnect(_:)), name: ExternalControllerDidConnectNotification, object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(ControllersSettingsViewController.externalControllerDidConnect(_:)), name: NSNotification.Name(rawValue: ExternalControllerDidConnectNotification), object: nil)
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(ControllersSettingsViewController.externalControllerDidDisconnect(_:)), name: ExternalControllerDidDisconnectNotification, object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(ControllersSettingsViewController.externalControllerDidDisconnect(_:)), name: NSNotification.Name(rawValue: ExternalControllerDidDisconnectNotification), object: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
override func viewDidLoad()
|
override func viewDidLoad()
|
||||||
|
|||||||
@ -25,8 +25,8 @@ class SettingsViewController: UITableViewController
|
|||||||
{
|
{
|
||||||
super.init(coder: aDecoder)
|
super.init(coder: aDecoder)
|
||||||
|
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(SettingsViewController.externalControllerDidConnect(_:)), name: ExternalControllerDidConnectNotification, object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(SettingsViewController.externalControllerDidConnect(_:)), name: NSNotification.Name(rawValue: ExternalControllerDidConnectNotification), object: nil)
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(SettingsViewController.externalControllerDidDisconnect(_:)), name: ExternalControllerDidDisconnectNotification, object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(SettingsViewController.externalControllerDidDisconnect(_:)), name: NSNotification.Name(rawValue: ExternalControllerDidDisconnectNotification), object: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
override func viewDidLoad()
|
override func viewDidLoad()
|
||||||
|
|||||||
@ -3,3 +3,4 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import "UIDevice+Vibration.h"
|
#import "UIDevice+Vibration.h"
|
||||||
|
#import "NSFetchedResultsController+Conveniences.h"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user