diff --git a/pkg/apple/HelperBar/CocoaView+HelperBar.swift b/pkg/apple/HelperBar/CocoaView+HelperBar.swift index e2632e9919..d16613d49e 100644 --- a/pkg/apple/HelperBar/CocoaView+HelperBar.swift +++ b/pkg/apple/HelperBar/CocoaView+HelperBar.swift @@ -16,6 +16,7 @@ protocol HelperBarActionDelegate: AnyObject { var isOrientationLocked: Bool { get } } +@available(iOS 13, *) extension CocoaView { @objc func setupHelperBar() { let helperVC = HelperBarViewController() @@ -34,6 +35,7 @@ extension CocoaView { } } +@available(iOS 13, *) extension CocoaView: HelperBarActionDelegate { func keyboardButtonTapped() { toggleCustomKeyboard() diff --git a/pkg/apple/HelperBar/HelperBarItem.swift b/pkg/apple/HelperBar/HelperBarItem.swift index dce782b999..0cb4d2f387 100644 --- a/pkg/apple/HelperBar/HelperBarItem.swift +++ b/pkg/apple/HelperBar/HelperBarItem.swift @@ -6,6 +6,7 @@ // Copyright © 2022 RetroArch. All rights reserved. // +@available(iOS 13, *) protocol HelperBarItem { var image: UIImage? { get } var selectedImage: UIImage? { get } @@ -16,10 +17,12 @@ protocol HelperBarItem { func action() } +@available(iOS 13, *) extension HelperBarItem { var tintColorOnSelection: UIColor? { nil } } +@available(iOS 13, *) struct KeyboardBarItem: HelperBarItem { let image = UIImage(systemName: "keyboard") let selectedImage = UIImage(systemName: "keyboard.fill") @@ -42,6 +45,7 @@ struct KeyboardBarItem: HelperBarItem { } } +@available(iOS 13, *) struct MouseBarItem: HelperBarItem { let image = UIImage(systemName: "computermouse") let selectedImage = UIImage(systemName: "computermouse.fill") @@ -59,6 +63,7 @@ struct MouseBarItem: HelperBarItem { } } +@available(iOS 13, *) struct LockOrientationBarItem: HelperBarItem { let image = UIImage(systemName: "lock.rotation") let selectedImage = UIImage(systemName: "lock.rotation") diff --git a/pkg/apple/HelperBar/HelperBarViewController.swift b/pkg/apple/HelperBar/HelperBarViewController.swift index 7ffe1585af..7278c8f0ef 100644 --- a/pkg/apple/HelperBar/HelperBarViewController.swift +++ b/pkg/apple/HelperBar/HelperBarViewController.swift @@ -6,6 +6,7 @@ // Copyright © 2022 RetroArch. All rights reserved. // +@available(iOS 13, *) class HelperBarViewController: UIViewController { var viewModel = HelperBarViewModel() @@ -137,12 +138,14 @@ class HelperBarViewController: UIViewController { } } +@available(iOS 13, *) extension HelperBarViewController: UIGestureRecognizerDelegate { func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool { true } } +@available(iOS 13, *) extension HelperBarViewController: HelperBarViewModelDelegate { func setNavigationBarHidden(_ isHidden: Bool) { navigationBar.isHidden = isHidden @@ -152,6 +155,7 @@ extension HelperBarViewController: HelperBarViewModelDelegate { } } +@available(iOS 13, *) extension HelperBarViewController: UINavigationBarDelegate { func position(for bar: UIBarPositioning) -> UIBarPosition { return .topAttached diff --git a/pkg/apple/HelperBar/HelperBarViewModel.swift b/pkg/apple/HelperBar/HelperBarViewModel.swift index 97c03bb202..0e253b8398 100644 --- a/pkg/apple/HelperBar/HelperBarViewModel.swift +++ b/pkg/apple/HelperBar/HelperBarViewModel.swift @@ -8,11 +8,13 @@ import Combine +@available(iOS 13, *) protocol HelperBarViewModelDelegate: AnyObject { func setNavigationBarHidden(_ isHidden: Bool) func updateNavigationBarItems() } +@available(iOS 13, *) class HelperBarViewModel { @Published var didInteractWithBar = false private var cancellable: AnyCancellable? diff --git a/pkg/apple/MouseEmulation/CocoaView+MouseSupport.swift b/pkg/apple/MouseEmulation/CocoaView+MouseSupport.swift index 055945a3fd..d8af8ffeec 100644 --- a/pkg/apple/MouseEmulation/CocoaView+MouseSupport.swift +++ b/pkg/apple/MouseEmulation/CocoaView+MouseSupport.swift @@ -7,6 +7,7 @@ // extension CocoaView { + @available(iOS 13, *) @objc func setupMouseSupport() { mouseHandler = EmulatorTouchMouseHandler(view: view, delegate: self as? EmulatorTouchMouseHandlerDelegate) } diff --git a/pkg/apple/MouseEmulation/EmulatorTouchMouse.swift b/pkg/apple/MouseEmulation/EmulatorTouchMouse.swift index a687a4153a..a2d541ea92 100644 --- a/pkg/apple/MouseEmulation/EmulatorTouchMouse.swift +++ b/pkg/apple/MouseEmulation/EmulatorTouchMouse.swift @@ -19,11 +19,13 @@ import Combine import UIKit +@available(iOS 13, *) @objc public protocol EmulatorTouchMouseHandlerDelegate: AnyObject { func handleMouseClick(isLeftClick: Bool, isPressed: Bool) func handleMouseMove(x: CGFloat, y: CGFloat) } +@available(iOS 13, *) @objcMembers public class EmulatorTouchMouseHandler: NSObject, UIPointerInteractionDelegate { enum MouseHoldState { case notHeld, wait, held diff --git a/pkg/apple/OnScreenKeyboard/CocoaView+KeyboardSupport.swift b/pkg/apple/OnScreenKeyboard/CocoaView+KeyboardSupport.swift index 33a2a1205c..3eb8760d7d 100644 --- a/pkg/apple/OnScreenKeyboard/CocoaView+KeyboardSupport.swift +++ b/pkg/apple/OnScreenKeyboard/CocoaView+KeyboardSupport.swift @@ -8,6 +8,7 @@ import Foundation +@available(iOS 13, *) extension CocoaView { var leftKeyboardModel: EmulatorKeyboardViewModel { return EmulatorKeyboardViewModel(keys: [ @@ -173,6 +174,7 @@ extension CocoaView { } } +@available(iOS 13, *) extension CocoaView: EmulatorKeyboardKeyPressedDelegate { func keyUp(_ key: KeyCoded) { print("keyUp: code=\(key.keyCode) keyboardModifierState = \(keyboardModifierState)") @@ -185,6 +187,7 @@ extension CocoaView: EmulatorKeyboardKeyPressedDelegate { } } +@available(iOS 13, *) extension CocoaView: EmulatorKeyboardModifierPressedDelegate { func modifierPressedWithKey(_ key: KeyCoded, enable: Bool) { switch UInt32(key.keyCode) { diff --git a/pkg/apple/OnScreenKeyboard/EmulatorKeyCoded.swift b/pkg/apple/OnScreenKeyboard/EmulatorKeyCoded.swift index b619a91730..c66eae32bc 100644 --- a/pkg/apple/OnScreenKeyboard/EmulatorKeyCoded.swift +++ b/pkg/apple/OnScreenKeyboard/EmulatorKeyCoded.swift @@ -6,11 +6,13 @@ // Copyright © 2022 RetroArch. All rights reserved. // +@available(iOS 13, *) @objc enum KeySize: Int { case standard = 1, wide, wider } // represents a key that has an underlying code that gets sent to the emulator +@available(iOS 13, *) @objc protocol KeyCoded: AnyObject { var keyLabel: String { get } var keyImageName: String? { get } @@ -20,10 +22,12 @@ var isModifier: Bool { get } } +@available(iOS 13, *) protocol KeyRowsDataSource { func keyForPositionAt(_ position: KeyPosition) -> KeyCoded? } +@available(iOS 13, *) @objc class EmulatorKeyboardKey: NSObject, KeyCoded { let keyLabel: String var keyImageName: String? @@ -45,6 +49,7 @@ protocol KeyRowsDataSource { } } +@available(iOS 13, *) class SpacerKey: KeyCoded { let keyLabel = "" let keyCode = 0 @@ -57,6 +62,7 @@ class SpacerKey: KeyCoded { } } +@available(iOS 13, *) class SliderKey: KeyCoded { let keyLabel = "" let keyCode = 0 diff --git a/pkg/apple/OnScreenKeyboard/EmulatorKeyboardButton.swift b/pkg/apple/OnScreenKeyboard/EmulatorKeyboardButton.swift index 4f586bcf7f..b2a7698300 100644 --- a/pkg/apple/OnScreenKeyboard/EmulatorKeyboardButton.swift +++ b/pkg/apple/OnScreenKeyboard/EmulatorKeyboardButton.swift @@ -8,6 +8,7 @@ import UIKit +@available(iOS 13, *) class EmulatorKeyboardButton: UIButton { let key: KeyCoded var toggleState = false diff --git a/pkg/apple/OnScreenKeyboard/EmulatorKeyboardView.swift b/pkg/apple/OnScreenKeyboard/EmulatorKeyboardView.swift index f69a481bd2..510cc8d562 100644 --- a/pkg/apple/OnScreenKeyboard/EmulatorKeyboardView.swift +++ b/pkg/apple/OnScreenKeyboard/EmulatorKeyboardView.swift @@ -7,22 +7,26 @@ // TODO: shift key should change the label of the keys to uppercase (need callback mechanism?) // pan gesture to outer edges of keyboard view for better dragging +@available(iOS 13, *) @objc protocol EmulatorKeyboardKeyPressedDelegate: AnyObject { func keyDown(_ key: KeyCoded) func keyUp(_ key: KeyCoded) } +@available(iOS 13, *) @objc protocol EmulatorKeyboardModifierPressedDelegate: AnyObject { func modifierPressedWithKey(_ key: KeyCoded, enable: Bool) func isModifierEnabled(key: KeyCoded) -> Bool } +@available(iOS 13, *) protocol EmulatorKeyboardViewDelegate: AnyObject { func toggleAlternateKeys() func refreshModifierStates() func updateTransparency(toAlpha alpha: Float) } +@available(iOS 13, *) class EmulatorKeyboardView: UIView { static var keyboardBackgroundColor = UIColor.systemGray6.withAlphaComponent(0.5) @@ -273,6 +277,7 @@ class EmulatorKeyboardView: UIView { } } +@available(iOS 13, *) extension UIImage { static func dot(size:CGSize, color:UIColor) -> UIImage { return UIGraphicsImageRenderer(size: size).image { context in diff --git a/pkg/apple/OnScreenKeyboard/EmulatorKeyboardViewController.swift b/pkg/apple/OnScreenKeyboard/EmulatorKeyboardViewController.swift index a79616123a..674e17b726 100644 --- a/pkg/apple/OnScreenKeyboard/EmulatorKeyboardViewController.swift +++ b/pkg/apple/OnScreenKeyboard/EmulatorKeyboardViewController.swift @@ -6,6 +6,7 @@ // Copyright © 2022 RetroArch. All rights reserved. // +@available(iOS 13, *) @objc class EmulatorKeyboardController: UIViewController { class EmulatorKeyboardPassthroughView: UIView { @@ -118,6 +119,7 @@ } } +@available(iOS 13, *) extension EmulatorKeyboardController: EmulatorKeyboardViewDelegate { func toggleAlternateKeys() { for keyboard in [leftKeyboardView, rightKeyboardView] { diff --git a/pkg/apple/OnScreenKeyboard/EmulatorKeyboardViewModel.swift b/pkg/apple/OnScreenKeyboard/EmulatorKeyboardViewModel.swift index b0fa7c0157..6a92a077ff 100644 --- a/pkg/apple/OnScreenKeyboard/EmulatorKeyboardViewModel.swift +++ b/pkg/apple/OnScreenKeyboard/EmulatorKeyboardViewModel.swift @@ -6,11 +6,13 @@ // Copyright © 2022 RetroArch. All rights reserved. // +@available(iOS 13, *) struct KeyPosition { let row: Int let column: Int } +@available(iOS 13, *) @objc class EmulatorKeyboardViewModel: NSObject, KeyRowsDataSource { var keys = [[KeyCoded]]() var alternateKeys: [[KeyCoded]]? diff --git a/pkg/apple/RetroArch_iOS13.xcodeproj/project.pbxproj b/pkg/apple/RetroArch_iOS13.xcodeproj/project.pbxproj index b31bc8841c..d74b8b6636 100644 --- a/pkg/apple/RetroArch_iOS13.xcodeproj/project.pbxproj +++ b/pkg/apple/RetroArch_iOS13.xcodeproj/project.pbxproj @@ -1795,7 +1795,7 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES; CODE_SIGN_ENTITLEMENTS = "$(IOS_CODE_SIGN_ENTITLEMENTS)"; INFOPLIST_FILE = "$(SRCROOT)/iOS/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = "$(RA_IPHONEOS_DEPLOYMENT_TARGET:default=13.0)"; + IPHONEOS_DEPLOYMENT_TARGET = "$(RA_IPHONEOS_DEPLOYMENT_TARGET:default=12.0)"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1815,7 +1815,7 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES; CODE_SIGN_ENTITLEMENTS = "$(IOS_CODE_SIGN_ENTITLEMENTS)"; INFOPLIST_FILE = "$(SRCROOT)/iOS/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = "$(RA_IPHONEOS_DEPLOYMENT_TARGET:default=13.0)"; + IPHONEOS_DEPLOYMENT_TARGET = "$(RA_IPHONEOS_DEPLOYMENT_TARGET:default=12.0)"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks",