From 334a8e0555e8566ab602723d6fd48035cbd488d9 Mon Sep 17 00:00:00 2001 From: ShinryakuTako <11238708+ShinryakuTako@users.noreply.github.com> Date: Thu, 26 Dec 2019 07:05:25 +0400 Subject: [PATCH] Fix tvOS support --- .../Apple API Extensions/OSAgnosticTypeAliases.swift | 7 ++++++- .../Touch Gestures/PanGestureRecognizerComponent.swift | 10 +++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Sources/OctopusKit/Apple API Extensions/OSAgnosticTypeAliases.swift b/Sources/OctopusKit/Apple API Extensions/OSAgnosticTypeAliases.swift index b4fcbb73..4a3a5dea 100644 --- a/Sources/OctopusKit/Apple API Extensions/OSAgnosticTypeAliases.swift +++ b/Sources/OctopusKit/Apple API Extensions/OSAgnosticTypeAliases.swift @@ -45,6 +45,11 @@ public typealias OSClickOrTapGestureRecognizer = UITapGestureRecognizer public typealias OSPanGestureRecognizer = UIPanGestureRecognizer public typealias OSMouseOrTouchEventComponent = TouchEventComponent -public typealias OSClickOrTapGestureRecognizerComponent = TapGestureRecognizerComponent + +#endif + +#if os(iOS) + +public typealias OSClickOrTapGestureRecognizerComponent = TapGestureRecognizerComponent // Not available on tvOS #endif diff --git a/Sources/OctopusKit/Components/Input/Touch Gestures/PanGestureRecognizerComponent.swift b/Sources/OctopusKit/Components/Input/Touch Gestures/PanGestureRecognizerComponent.swift index df4238a7..3952e310 100644 --- a/Sources/OctopusKit/Components/Input/Touch Gestures/PanGestureRecognizerComponent.swift +++ b/Sources/OctopusKit/Components/Input/Touch Gestures/PanGestureRecognizerComponent.swift @@ -30,14 +30,14 @@ public final class PanGestureRecognizerComponent: OctopusGestureRecognizerCompon super.init() self.gestureRecognizer.delegate = self - #if canImport(AppKit) - self.compatibleGestureRecognizerTypes = [NSMagnificationGestureRecognizer.self] - #elseif canImport(UIKit) + #if os(iOS) self.compatibleGestureRecognizerTypes = [UIPinchGestureRecognizer.self] + #elseif os(macOS) + self.compatibleGestureRecognizerTypes = [NSMagnificationGestureRecognizer.self] #endif } - #if canImport(UIKit) // MARK: - iOS + #if os(iOS) // MARK: - iOS /// - NOTE: Unless specified, `maximumNumberOfTouches` will be set equal to `minimumNumberOfTouches`. public convenience init(minimumNumberOfTouches: Int = 1, @@ -52,7 +52,7 @@ public final class PanGestureRecognizerComponent: OctopusGestureRecognizerCompon #endif - #if canImport(AppKit) // MARK: - macOS + #if os(macOS) // MARK: - macOS public convenience init(buttonMask: Int = 0x1, numberOfTouchesRequired: Int = 1)