Removes 4.2 migrator helper functions

This commit is contained in:
Riley Testut 2018-11-12 11:51:04 -08:00
parent ba653037b1
commit 4939a7da25
3 changed files with 3 additions and 34 deletions

View File

@ -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
}

View File

@ -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
}

View File

@ -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)})
}