Updates syntax to Swift 3 Beta 4 via Xcode migrator

This commit is contained in:
Riley Testut 2016-08-06 22:57:18 -05:00
parent ddb402537e
commit 95a2efdc01
16 changed files with 61 additions and 61 deletions

View File

@ -110,7 +110,7 @@ class GridCollectionViewCell: UICollectionViewCell
self.textLabelFocusedVerticalSpacingConstraint?.isActive = true self.textLabelFocusedVerticalSpacingConstraint?.isActive = true
self.textLabel.textColor = UIColor.white() self.textLabel.textColor = UIColor.white
} }
else else
@ -120,7 +120,7 @@ class GridCollectionViewCell: UICollectionViewCell
self.textLabelBottomAnchorConstraint?.isActive = true self.textLabelBottomAnchorConstraint?.isActive = true
self.textLabelVerticalSpacingConstraint.isActive = true self.textLabelVerticalSpacingConstraint.isActive = true
self.textLabel.textColor = UIColor.black() self.textLabel.textColor = UIColor.black
} }
self.layoutIfNeeded() self.layoutIfNeeded()

View File

@ -192,7 +192,7 @@ extension DatabaseManager
{ {
let documentsDirectoryURL: URL let documentsDirectoryURL: URL
if UIDevice.current().userInterfaceIdiom == .tv if UIDevice.current.userInterfaceIdiom == .tv
{ {
documentsDirectoryURL = FileManager.default.urlsForDirectory(FileManager.SearchPathDirectory.cachesDirectory, inDomains: FileManager.SearchPathDomainMask.userDomainMask).first! documentsDirectoryURL = FileManager.default.urlsForDirectory(FileManager.SearchPathDirectory.cachesDirectory, inDomains: FileManager.SearchPathDomainMask.userDomainMask).first!
} }

View File

@ -88,7 +88,7 @@ class GameViewController: DeltaCore.GameViewController
if gameController is ControllerView && UIDevice.current().isVibrationSupported if gameController is ControllerView && UIDevice.current().isVibrationSupported
{ {
UIDevice.current().vibrate() UIDevice.current.vibrate()
} }
guard (input as? ControllerInput) != .menu else { return } guard (input as? ControllerInput) != .menu else { return }
@ -190,7 +190,7 @@ extension GameViewController
self.pausingGameController = gameController self.pausingGameController = gameController
let pauseViewController = segue.destinationViewController as! PauseViewController let pauseViewController = segue.destination as! PauseViewController
pauseViewController.pauseText = (self.game as? Game)?.name ?? NSLocalizedString("Delta", comment: "") pauseViewController.pauseText = (self.game as? Game)?.name ?? NSLocalizedString("Delta", comment: "")
pauseViewController.emulatorCore = self.emulatorCore pauseViewController.emulatorCore = self.emulatorCore
pauseViewController.saveStatesViewControllerDelegate = self pauseViewController.saveStatesViewControllerDelegate = self
@ -560,7 +560,7 @@ private extension GameViewController
/// GameViewControllerDelegate /// GameViewControllerDelegate
extension GameViewController: GameViewControllerDelegate extension GameViewController: GameViewControllerDelegate
{ {
func gameViewController(gameViewController: DeltaCore.GameViewController, handleMenuInputFrom gameController: GameController) func gameViewController(_ gameViewController: DeltaCore.GameViewController, handleMenuInputFrom gameController: GameController)
{ {
if self.selectingSustainedButtons if self.selectingSustainedButtons
{ {
@ -571,12 +571,12 @@ extension GameViewController: GameViewControllerDelegate
self.performSegue(withIdentifier: "pause", sender: gameController) self.performSegue(withIdentifier: "pause", sender: gameController)
} }
func gameViewControllerShouldResumeEmulation(gameViewController: DeltaCore.GameViewController) -> Bool func gameViewControllerShouldResumeEmulation(_ gameViewController: DeltaCore.GameViewController) -> Bool
{ {
return self.pauseViewController == nil && !self.selectingSustainedButtons return self.pauseViewController == nil && !self.selectingSustainedButtons
} }
func gameViewControllerDidUpdate(gameViewController: DeltaCore.GameViewController) func gameViewControllerDidUpdate(_ gameViewController: DeltaCore.GameViewController)
{ {
for semaphore in self.updateSemaphores for semaphore in self.updateSemaphores
{ {

View File

@ -58,8 +58,8 @@ class GamesViewController: UIViewController
self.pageControl.translatesAutoresizingMaskIntoConstraints = false self.pageControl.translatesAutoresizingMaskIntoConstraints = false
self.pageControl.hidesForSinglePage = false self.pageControl.hidesForSinglePage = false
self.pageControl.numberOfPages = 3 self.pageControl.numberOfPages = 3
self.pageControl.currentPageIndicatorTintColor = UIColor.purple() self.pageControl.currentPageIndicatorTintColor = UIColor.purple
self.pageControl.pageIndicatorTintColor = UIColor.lightGray() self.pageControl.pageIndicatorTintColor = UIColor.lightGray
self.navigationController?.toolbar.addSubview(self.pageControl) self.navigationController?.toolbar.addSubview(self.pageControl)
self.pageControl.centerXAnchor.constraint(equalTo: (self.navigationController?.toolbar.centerXAnchor)!, constant: 0).isActive = true self.pageControl.centerXAnchor.constraint(equalTo: (self.navigationController?.toolbar.centerXAnchor)!, constant: 0).isActive = true
@ -117,8 +117,8 @@ class GamesViewController: UIViewController
// In a storyboard-based application, you will often want to do a little preparation before navigation // In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: AnyObject?) override func prepare(for segue: UIStoryboardSegue, sender: AnyObject?)
{ {
guard let sourceViewController = segue.sourceViewController as? GamesCollectionViewController else { return } guard let sourceViewController = segue.source as? GamesCollectionViewController else { return }
guard let destinationViewController = segue.destinationViewController as? GameViewController else { return } guard let destinationViewController = segue.destination as? GameViewController else { return }
guard let cell = sender as? UICollectionViewCell else { return } guard let cell = sender as? UICollectionViewCell else { return }
let indexPath = sourceViewController.collectionView?.indexPath(for: cell) let indexPath = sourceViewController.collectionView?.indexPath(for: cell)

View File

@ -12,7 +12,7 @@ import DeltaCore
extension CheatValidator extension CheatValidator
{ {
enum Error: ErrorProtocol enum Error: Swift.Error
{ {
case invalidCode case invalidCode
case invalidName case invalidName

View File

@ -46,9 +46,9 @@ extension CheatsViewController
self.backgroundView.isHidden = false self.backgroundView.isHidden = false
self.backgroundView.autoresizingMask = [.flexibleWidth, .flexibleHeight] self.backgroundView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
self.backgroundView.textLabel.text = NSLocalizedString("No Cheats", comment: "") self.backgroundView.textLabel.text = NSLocalizedString("No Cheats", comment: "")
self.backgroundView.textLabel.textColor = UIColor.white() self.backgroundView.textLabel.textColor = UIColor.white
self.backgroundView.detailTextLabel.text = NSLocalizedString("You can add a new cheat by pressing the + button in the top right.", comment: "") self.backgroundView.detailTextLabel.text = NSLocalizedString("You can add a new cheat by pressing the + button in the top right.", comment: "")
self.backgroundView.detailTextLabel.textColor = UIColor.white() self.backgroundView.detailTextLabel.textColor = UIColor.white
self.tableView.backgroundView = self.backgroundView self.tableView.backgroundView = self.backgroundView
self.registerForPreviewing(with: self, sourceView: self.tableView) self.registerForPreviewing(with: self, sourceView: self.tableView)
@ -135,7 +135,7 @@ private extension CheatsViewController
/// Convenience /// Convenience
private extension CheatsViewController private extension CheatsViewController
{ {
func configure(cell: UITableViewCell, forIndexPath indexPath: IndexPath) func configure(_ cell: UITableViewCell, forIndexPath indexPath: IndexPath)
{ {
let cheat = self.fetchedResultsController.object(at: indexPath) as! Cheat let cheat = self.fetchedResultsController.object(at: indexPath) as! Cheat
cell.textLabel?.text = cheat.name cell.textLabel?.text = cheat.name
@ -173,7 +173,7 @@ extension CheatsViewController
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
{ {
let cell = tableView.dequeueReusableCell(withIdentifier: RSTGenericCellIdentifier, for: indexPath) let cell = tableView.dequeueReusableCell(withIdentifier: RSTGenericCellIdentifier, for: indexPath)
self.configure(cell: cell, forIndexPath: indexPath) self.configure(cell, forIndexPath: indexPath)
return cell return cell
} }
} }

View File

@ -160,7 +160,7 @@ extension EditCheatViewController
guard let cheat = self.cheat else { return [] } guard let cheat = self.cheat else { return [] }
let copyCodeAction = UIPreviewAction(title: NSLocalizedString("Copy Code", comment: ""), style: .default) { (action, viewController) in let copyCodeAction = UIPreviewAction(title: NSLocalizedString("Copy Code", comment: ""), style: .default) { (action, viewController) in
UIPasteboard.general().string = cheat.code UIPasteboard.general.string = cheat.code
} }
let presentingViewController = self.presentingViewController! let presentingViewController = self.presentingViewController!

View File

@ -72,21 +72,21 @@ private extension PauseMenuViewController
cell.imageView.image = pauseItem.image cell.imageView.image = pauseItem.image
cell.imageView.contentMode = .center cell.imageView.contentMode = .center
cell.imageView.layer.borderWidth = 2 cell.imageView.layer.borderWidth = 2
cell.imageView.layer.borderColor = UIColor.white().cgColor cell.imageView.layer.borderColor = UIColor.white.cgColor
cell.imageView.layer.cornerRadius = 10 cell.imageView.layer.cornerRadius = 10
cell.textLabel.text = pauseItem.text cell.textLabel.text = pauseItem.text
cell.textLabel.textColor = UIColor.white() cell.textLabel.textColor = UIColor.white
if pauseItem.selected if pauseItem.selected
{ {
cell.imageView.tintColor = UIColor.black() cell.imageView.tintColor = UIColor.black
cell.imageView.backgroundColor = UIColor.white() cell.imageView.backgroundColor = UIColor.white
} }
else else
{ {
cell.imageView.tintColor = UIColor.white() cell.imageView.tintColor = UIColor.white
cell.imageView.backgroundColor = UIColor.clear() cell.imageView.backgroundColor = UIColor.clear
} }
} }

View File

@ -89,10 +89,10 @@ extension PauseViewController
switch identifier switch identifier
{ {
case "embedNavigationController": case "embedNavigationController":
self.pauseNavigationController = segue.destinationViewController as! UINavigationController self.pauseNavigationController = segue.destination as! UINavigationController
self.pauseNavigationController.delegate = self self.pauseNavigationController.delegate = self
self.pauseNavigationController.navigationBar.tintColor = UIColor.deltaLightPurpleColor() self.pauseNavigationController.navigationBar.tintColor = UIColor.deltaLightPurpleColor()
self.pauseNavigationController.view.backgroundColor = UIColor.clear() self.pauseNavigationController.view.backgroundColor = UIColor.clear
let pauseMenuViewController = self.pauseNavigationController.topViewController as! PauseMenuViewController let pauseMenuViewController = self.pauseNavigationController.topViewController as! PauseMenuViewController
pauseMenuViewController.items = self.pauseItems pauseMenuViewController.items = self.pauseItems
@ -101,14 +101,14 @@ extension PauseViewController
self.view.addSubview(self.pauseNavigationController.navigationBar) self.view.addSubview(self.pauseNavigationController.navigationBar)
case "saveStates": case "saveStates":
let saveStatesViewController = segue.destinationViewController as! SaveStatesViewController let saveStatesViewController = segue.destination as! SaveStatesViewController
saveStatesViewController.delegate = self.saveStatesViewControllerDelegate saveStatesViewController.delegate = self.saveStatesViewControllerDelegate
saveStatesViewController.game = self.emulatorCore?.game as? Game saveStatesViewController.game = self.emulatorCore?.game as? Game
saveStatesViewController.emulatorCore = self.emulatorCore saveStatesViewController.emulatorCore = self.emulatorCore
saveStatesViewController.mode = self.saveStatesViewControllerMode saveStatesViewController.mode = self.saveStatesViewControllerMode
case "cheats": case "cheats":
let cheatsViewController = segue.destinationViewController as! CheatsViewController let cheatsViewController = segue.destination as! CheatsViewController
cheatsViewController.delegate = self.cheatsViewControllerDelegate cheatsViewController.delegate = self.cheatsViewControllerDelegate
cheatsViewController.game = self.emulatorCore?.game as? Game cheatsViewController.game = self.emulatorCore?.game as? Game

View File

@ -37,14 +37,14 @@ class PausePresentationController: UIPresentationController
override func frameOfPresentedViewInContainerView() -> CGRect override func frameOfPresentedViewInContainerView() -> CGRect
{ {
guard let containerView = self.containerView else { return super.frameOfPresentedViewInContainerView() } guard let containerView = self.containerView else { return super.frameOfPresentedViewInContainerView }
let frame: CGRect let frame: CGRect
let contentHeight = self.presentedViewController.preferredContentSize.height let contentHeight = self.presentedViewController.preferredContentSize.height
if contentHeight == 0 if contentHeight == 0
{ {
let statusBarHeight = UIApplication.shared().statusBarFrame.height let statusBarHeight = UIApplication.shared.statusBarFrame.height
frame = CGRect(x: 0, y: statusBarHeight, width: containerView.bounds.width, height: containerView.bounds.height - statusBarHeight) frame = CGRect(x: 0, y: statusBarHeight, width: containerView.bounds.width, height: containerView.bounds.height - statusBarHeight)
} }
else else
@ -83,7 +83,7 @@ class PausePresentationController: UIPresentationController
self.contentView.alpha = 0.0 self.contentView.alpha = 0.0
self.vibrancyView.contentView.addSubview(self.contentView) self.vibrancyView.contentView.addSubview(self.contentView)
self.presentingViewController.transitionCoordinator()?.animate(alongsideTransition: { context in self.presentingViewController.transitionCoordinator?.animate(alongsideTransition: { context in
let blurEffect = UIBlurEffect(style: .dark) let blurEffect = UIBlurEffect(style: .dark)
@ -97,7 +97,7 @@ class PausePresentationController: UIPresentationController
override func dismissalTransitionWillBegin() override func dismissalTransitionWillBegin()
{ {
self.presentingViewController.transitionCoordinator()?.animate(alongsideTransition: { context in self.presentingViewController.transitionCoordinator?.animate(alongsideTransition: { context in
self.blurringView.effect = nil self.blurringView.effect = nil
self.vibrancyView.effect = nil self.vibrancyView.effect = nil
self.contentView.alpha = 0.0 self.contentView.alpha = 0.0
@ -120,10 +120,10 @@ class PausePresentationController: UIPresentationController
self.contentView.frame = self.containerView!.bounds self.contentView.frame = self.containerView!.bounds
self.contentView.frame.origin.y = currentY self.contentView.frame.origin.y = currentY
if self.presentedView()!.frame.minY == 0 if self.presentedView!.frame.minY == 0
{ {
// Temporarily offset top of presentedView by a small amount to prevent navigation bar from growing when rotating from landscape to portrait // Temporarily offset top of presentedView by a small amount to prevent navigation bar from growing when rotating from landscape to portrait
self.presentedView()?.frame.origin.y = 0.5 self.presentedView?.frame.origin.y = 0.5
} }
} }
@ -143,7 +143,7 @@ class PausePresentationController: UIPresentationController
self.contentView.removeFromSuperview() self.contentView.removeFromSuperview()
// Temporarily match the bounds of self.containerView (accounting for the status bar) // Temporarily match the bounds of self.containerView (accounting for the status bar)
let statusBarHeight = UIApplication.shared().statusBarFrame.height let statusBarHeight = UIApplication.shared.statusBarFrame.height
self.contentView.frame = CGRect(x: 0, y: statusBarHeight, width: self.containerView!.bounds.width, height: self.containerView!.bounds.height - statusBarHeight) self.contentView.frame = CGRect(x: 0, y: statusBarHeight, width: self.containerView!.bounds.width, height: self.containerView!.bounds.height - statusBarHeight)
// Layout content view // Layout content view
@ -158,13 +158,13 @@ class PausePresentationController: UIPresentationController
// Ensure width is correct // Ensure width is correct
self.presentedView()?.bounds.size.width = self.containerView!.bounds.width self.presentedView?.bounds.size.width = self.containerView!.bounds.width
self.presentedView()?.setNeedsLayout() self.presentedView?.setNeedsLayout()
self.presentedView()?.layoutIfNeeded() self.presentedView?.layoutIfNeeded()
if self.presentingViewController.transitionCoordinator() == nil if self.presentingViewController.transitionCoordinator == nil
{ {
self.presentedView()?.frame = self.frameOfPresentedViewInContainerView() self.presentedView?.frame = self.frameOfPresentedViewInContainerView()
} }
// Unhide pauseIconImageView so its height is involved with layout calculations // Unhide pauseIconImageView so its height is involved with layout calculations

View File

@ -29,7 +29,7 @@ class SaveStatesCollectionHeaderView: UICollectionReusableView
private func initialize() private func initialize()
{ {
self.textLabel.translatesAutoresizingMaskIntoConstraints = false self.textLabel.translatesAutoresizingMaskIntoConstraints = false
self.textLabel.textColor = UIColor.white() self.textLabel.textColor = UIColor.white
var fontDescriptor = UIFontDescriptor.preferredFontDescriptor(withTextStyle: UIFontTextStyleTitle3) var fontDescriptor = UIFontDescriptor.preferredFontDescriptor(withTextStyle: UIFontTextStyleTitle3)
fontDescriptor = fontDescriptor.withSymbolicTraits([.traitBold])! fontDescriptor = fontDescriptor.withSymbolicTraits([.traitBold])!

View File

@ -58,7 +58,7 @@ class SaveStatesViewController: UICollectionViewController
private var fetchedResultsController: NSFetchedResultsController<NSFetchRequestResult>! private var fetchedResultsController: NSFetchedResultsController<NSFetchRequestResult>!
private let imageOperationQueue = RSTOperationQueue() private let imageOperationQueue = RSTOperationQueue()
private let imageCache = Cache<NSURL, UIImage>() private let imageCache = Cache<URL, UIImage>()
private var emulatorCoreSaveState: SaveStateProtocol? private var emulatorCoreSaveState: SaveStateProtocol?
private var selectedSaveState: SaveState? private var selectedSaveState: SaveState?
@ -88,13 +88,13 @@ extension SaveStatesViewController
self.backgroundView.isHidden = true self.backgroundView.isHidden = true
self.backgroundView.autoresizingMask = [.flexibleWidth, .flexibleHeight] self.backgroundView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
self.backgroundView.textLabel.text = NSLocalizedString("No Save States", comment: "") self.backgroundView.textLabel.text = NSLocalizedString("No Save States", comment: "")
self.backgroundView.textLabel.textColor = UIColor.white() self.backgroundView.textLabel.textColor = UIColor.white
self.backgroundView.detailTextLabel.textColor = UIColor.white() self.backgroundView.detailTextLabel.textColor = UIColor.white
self.view.insertSubview(self.backgroundView, at: 0) self.view.insertSubview(self.backgroundView, at: 0)
let collectionViewLayout = self.collectionViewLayout as! GridCollectionViewLayout let collectionViewLayout = self.collectionViewLayout as! GridCollectionViewLayout
let averageHorizontalInset = (collectionViewLayout.sectionInset.left + collectionViewLayout.sectionInset.right) / 2 let averageHorizontalInset = (collectionViewLayout.sectionInset.left + collectionViewLayout.sectionInset.right) / 2
let portraitScreenWidth = UIScreen.main().coordinateSpace.convert(UIScreen.main().bounds, to: UIScreen.main().fixedCoordinateSpace).width let portraitScreenWidth = UIScreen.main.coordinateSpace.convert(UIScreen.main.bounds, to: UIScreen.main.fixedCoordinateSpace).width
// Use dimensions that allow two cells to fill the screen horizontally with padding in portrait mode // Use dimensions that allow two cells to fill the screen horizontally with padding in portrait mode
// We'll keep the same size for landscape orientation, which will allow more to fit // We'll keep the same size for landscape orientation, which will allow more to fit
@ -185,7 +185,7 @@ private extension SaveStatesViewController
{ {
let saveState = self.fetchedResultsController.object(at: indexPath) as! SaveState let saveState = self.fetchedResultsController.object(at: indexPath) as! SaveState
cell.imageView.backgroundColor = UIColor.white() cell.imageView.backgroundColor = UIColor.white
cell.imageView.image = UIImage(named: "DeltaPlaceholder") cell.imageView.image = UIImage(named: "DeltaPlaceholder")
if !ignoreOperations if !ignoreOperations
@ -215,7 +215,7 @@ private extension SaveStatesViewController
let dimensions = deltaCore.emulatorConfiguration.videoBufferInfo.outputDimensions let dimensions = deltaCore.emulatorConfiguration.videoBufferInfo.outputDimensions
cell.maximumImageSize = CGSize(width: self.prototypeCellWidthConstraint.constant, height: (self.prototypeCellWidthConstraint.constant / dimensions.width) * dimensions.height) cell.maximumImageSize = CGSize(width: self.prototypeCellWidthConstraint.constant, height: (self.prototypeCellWidthConstraint.constant / dimensions.width) * dimensions.height)
cell.textLabel.textColor = UIColor.white() cell.textLabel.textColor = UIColor.white
cell.textLabel.font = UIFont.preferredFont(forTextStyle: UIFontTextStyleSubheadline) cell.textLabel.font = UIFont.preferredFont(forTextStyle: UIFontTextStyleSubheadline)
let name = saveState.name ?? self.dateFormatter.string(from: saveState.modifiedDate) let name = saveState.name ?? self.dateFormatter.string(from: saveState.modifiedDate)
@ -509,7 +509,7 @@ private extension SaveStatesViewController
// Kinda hacky, but isMovingFromParentViewController only returns yes when popping off navigation controller, and not being dismissed modally // Kinda hacky, but isMovingFromParentViewController only returns yes when popping off navigation controller, and not being dismissed modally
// Because of this, this is only run when the user returns to PauseMenuViewController, and not when they choose a save state to load // Because of this, this is only run when the user returns to PauseMenuViewController, and not when they choose a save state to load
guard self.isMovingFromParentViewController() else { return } guard self.isMovingFromParentViewController else { return }
self.prepareEmulatorCore() self.prepareEmulatorCore()
} }

View File

@ -25,14 +25,14 @@ class PauseStoryboardSegue: UIStoryboardSegue
override func perform() override func perform()
{ {
self.destinationViewController.transitioningDelegate = self self.destination.transitioningDelegate = self
self.destinationViewController.modalPresentationStyle = .custom self.destination.modalPresentationStyle = .custom
self.destinationViewController.modalPresentationCapturesStatusBarAppearance = true self.destination.modalPresentationCapturesStatusBarAppearance = true
// We need to force layout of destinationViewController.view _before_ animateTransition(using:) // We need to force layout of destinationViewController.view _before_ animateTransition(using:)
// Otherwise, we'll get "Unable to simultaneously satisfy constraints" errors // Otherwise, we'll get "Unable to simultaneously satisfy constraints" errors
self.destinationViewController.view.frame = self.sourceViewController.view.frame self.destination.view.frame = self.source.view.frame
self.destinationViewController.view.layoutIfNeeded() self.destination.view.layoutIfNeeded()
super.perform() super.perform()
} }
@ -69,8 +69,8 @@ extension PauseStoryboardSegue: UIViewControllerAnimatedTransitioning
let presentedViewController = transitionContext.viewController(forKey: UITransitionContextToViewControllerKey)! let presentedViewController = transitionContext.viewController(forKey: UITransitionContextToViewControllerKey)!
presentedView.frame = transitionContext.finalFrame(for: presentedViewController) presentedView.frame = transitionContext.finalFrame(for: presentedViewController)
presentedView.frame.origin.y = transitionContext.containerView().bounds.height presentedView.frame.origin.y = transitionContext.containerView.bounds.height
transitionContext.containerView().addSubview(presentedView) transitionContext.containerView.addSubview(presentedView)
self.animator.addAnimations { [unowned self] in self.animator.addAnimations { [unowned self] in
presentedView.frame = self.presentationController.frameOfPresentedViewInContainerView() presentedView.frame = self.presentationController.frameOfPresentedViewInContainerView()

View File

@ -32,14 +32,14 @@ class PauseTransitionCoordinator: NSObject, UIViewControllerAnimatedTransitionin
let sourceViewController = transitionContext.viewController(forKey: UITransitionContextFromViewControllerKey)! let sourceViewController = transitionContext.viewController(forKey: UITransitionContextFromViewControllerKey)!
destinationViewController.view.frame = transitionContext.finalFrame(for: destinationViewController) destinationViewController.view.frame = transitionContext.finalFrame(for: destinationViewController)
destinationViewController.view.frame.origin.y = self.presenting ? transitionContext.containerView().bounds.height : -destinationViewController.view.bounds.height destinationViewController.view.frame.origin.y = self.presenting ? transitionContext.containerView.bounds.height : -destinationViewController.view.bounds.height
transitionContext.containerView().addSubview(destinationViewController.view) transitionContext.containerView.addSubview(destinationViewController.view)
destinationViewController.view.layoutIfNeeded() destinationViewController.view.layoutIfNeeded()
UIView.animate(withDuration: self.transitionDuration(using: transitionContext), delay:0, options:RSTSystemTransitionAnimationCurve, animations: { UIView.animate(withDuration: self.transitionDuration(using: transitionContext), delay:0, options:RSTSystemTransitionAnimationCurve, animations: {
sourceViewController.view.frame.origin.y = self.presenting ? -sourceViewController.view.bounds.height : transitionContext.containerView().bounds.height sourceViewController.view.frame.origin.y = self.presenting ? -sourceViewController.view.bounds.height : transitionContext.containerView.bounds.height
destinationViewController.view.frame.origin.y = 0 destinationViewController.view.frame.origin.y = 0
self.presentationController.containerView?.setNeedsLayout() self.presentationController.containerView?.setNeedsLayout()

View File

@ -19,7 +19,7 @@ private enum ControllersSettingsSection: Int
private class LocalDeviceController: ExternalController private class LocalDeviceController: ExternalController
{ {
override var name: String { override var name: String {
return UIDevice.current().name return UIDevice.current.name
} }
} }

View File

@ -53,7 +53,7 @@ class SettingsViewController: UITableViewController
{ {
if segue.identifier == SettingsSegues.Controllers.rawValue if segue.identifier == SettingsSegues.Controllers.rawValue
{ {
let controllersSettingsViewController = segue.destinationViewController as! ControllersSettingsViewController let controllersSettingsViewController = segue.destination as! ControllersSettingsViewController
controllersSettingsViewController.playerIndex = (self.tableView.indexPathForSelectedRow as NSIndexPath?)?.row controllersSettingsViewController.playerIndex = (self.tableView.indexPathForSelectedRow as NSIndexPath?)?.row
} }
} }
@ -94,7 +94,7 @@ extension SettingsViewController
{ {
if (indexPath as NSIndexPath).row == Settings.localControllerPlayerIndex if (indexPath as NSIndexPath).row == Settings.localControllerPlayerIndex
{ {
cell.detailTextLabel?.text = UIDevice.current().name cell.detailTextLabel?.text = UIDevice.current.name
} }
else if let index = ExternalControllerManager.shared.connectedControllers.index(where: { $0.playerIndex == (indexPath as NSIndexPath).row }) else if let index = ExternalControllerManager.shared.connectedControllers.index(where: { $0.playerIndex == (indexPath as NSIndexPath).row })
{ {