From 4939a7da25bb0a3b5a103cceddf9de32385f279c Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Mon, 12 Nov 2018 11:51:04 -0800 Subject: [PATCH] Removes 4.2 migrator helper functions --- Delta/Emulation/GameViewController.swift | 13 +------------ .../Import Options/PhotoLibraryImportOption.swift | 15 +-------------- .../Cheats/EditCheatViewController.swift | 9 +-------- 3 files changed, 3 insertions(+), 34 deletions(-) diff --git a/Delta/Emulation/GameViewController.swift b/Delta/Emulation/GameViewController.swift index 44786dd..f7e7d2c 100644 --- a/Delta/Emulation/GameViewController.swift +++ b/Delta/Emulation/GameViewController.swift @@ -110,7 +110,7 @@ class GameViewController: DeltaCore.GameViewController private var _isLoadingSaveState = false - private var context = CIContext(options: convertToOptionalCIContextOptionDictionary([convertFromCIContextOption(CIContextOption.workingColorSpace): NSNull()])) + private var context = CIContext(options: [.workingColorSpace: NSNull()]) // Sustain Buttons private var isSelectingSustainedButtons = false @@ -949,14 +949,3 @@ private extension GameViewController self.dismiss(animated: true, completion: nil) } } - -// Helper function inserted by Swift 4.2 migrator. -fileprivate func convertToOptionalCIContextOptionDictionary(_ input: [String: Any]?) -> [CIContextOption: Any]? { - guard let input = input else { return nil } - return Dictionary(uniqueKeysWithValues: input.map { key, value in (CIContextOption(rawValue: key), value)}) -} - -// Helper function inserted by Swift 4.2 migrator. -fileprivate func convertFromCIContextOption(_ input: CIContextOption) -> String { - return input.rawValue -} diff --git a/Delta/Importing/Import Options/PhotoLibraryImportOption.swift b/Delta/Importing/Import Options/PhotoLibraryImportOption.swift index 50f8f09..918d084 100644 --- a/Delta/Importing/Import Options/PhotoLibraryImportOption.swift +++ b/Delta/Importing/Import Options/PhotoLibraryImportOption.swift @@ -41,10 +41,7 @@ extension PhotoLibraryImportOption: UIImagePickerControllerDelegate, UINavigatio { func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) { -// Local variable inserted by Swift 4.2 migrator. -let info = convertFromUIImagePickerControllerInfoKeyDictionary(info) - - guard let image = info[convertFromUIImagePickerControllerInfoKey(UIImagePickerController.InfoKey.originalImage)] as? UIImage, let data = image.jpegData(compressionQuality: 0.85) else { + guard let image = info[.originalImage] as? UIImage, let data = image.jpegData(compressionQuality: 0.85) else { self.completionHandler?([]) return } @@ -62,13 +59,3 @@ let info = convertFromUIImagePickerControllerInfoKeyDictionary(info) } } } - -// Helper function inserted by Swift 4.2 migrator. -fileprivate func convertFromUIImagePickerControllerInfoKeyDictionary(_ input: [UIImagePickerController.InfoKey: Any]) -> [String: Any] { - return Dictionary(uniqueKeysWithValues: input.map {key, value in (key.rawValue, value)}) -} - -// Helper function inserted by Swift 4.2 migrator. -fileprivate func convertFromUIImagePickerControllerInfoKey(_ input: UIImagePickerController.InfoKey) -> String { - return input.rawValue -} diff --git a/Delta/Pause Menu/Cheats/EditCheatViewController.swift b/Delta/Pause Menu/Cheats/EditCheatViewController.swift index 3f80ba2..0ace6a0 100644 --- a/Delta/Pause Menu/Cheats/EditCheatViewController.swift +++ b/Delta/Pause Menu/Cheats/EditCheatViewController.swift @@ -382,9 +382,7 @@ extension EditCheatViewController: UITextViewDelegate // We need to manually add back the attributes when manually modifying the underlying text storage // Otherwise, pasting text into an empty text view will result in the wrong font being used - let attributes = Dictionary(uniqueKeysWithValues: convertFromNSAttributedStringKeyDictionary(textView.typingAttributes).map { (key, value) in (NSAttributedString.Key(key), value) }) - - let attributedString = NSAttributedString(string: sanitizedText, attributes: attributes) + let attributedString = NSAttributedString(string: sanitizedText, attributes: textView.typingAttributes) textView.textStorage.replaceCharacters(in: range, with: attributedString) // We must add attributedString.length, not range.length, in case the attributed string's length differs @@ -393,8 +391,3 @@ extension EditCheatViewController: UITextViewDelegate return false } } - -// Helper function inserted by Swift 4.2 migrator. -fileprivate func convertFromNSAttributedStringKeyDictionary(_ input: [NSAttributedString.Key: Any]) -> [String: Any] { - return Dictionary(uniqueKeysWithValues: input.map {key, value in (key.rawValue, value)}) -}