From 213b5f363a3e749b541cc41139e148dc307cb06d Mon Sep 17 00:00:00 2001 From: Roman Podymov Date: Sat, 7 Oct 2023 20:39:19 +0200 Subject: [PATCH 1/2] tvOS --- Package.swift | 3 ++- SimpleCheckbox.podspec | 3 ++- checkbox/Checkbox.swift | 7 ++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Package.swift b/Package.swift index f7e6b28..1f34a2c 100644 --- a/Package.swift +++ b/Package.swift @@ -6,7 +6,8 @@ import PackageDescription let package = Package( name: "SimpleCheckbox", platforms: [ - .iOS(.v11) + .iOS(.v11), + .tvOS(.v11) ], products: [ .library( diff --git a/SimpleCheckbox.podspec b/SimpleCheckbox.podspec index 158e3c9..166cbf6 100644 --- a/SimpleCheckbox.podspec +++ b/SimpleCheckbox.podspec @@ -24,7 +24,8 @@ Pod::Spec.new do |s| s.author = "Beau Nouvelle" s.social_media_url = "http://twitter.com/BeauNouvelle" - s.platform = :ios, "11.0" + s.ios.deployment_target = "11.0" + s.tvos.deployment_target = "11.0" s.source = { :git => "https://github.com/BeauNouvelle/SimpleCheckbox.git", :tag => "#{s.version}" } diff --git a/checkbox/Checkbox.swift b/checkbox/Checkbox.swift index a44b287..d6792a8 100644 --- a/checkbox/Checkbox.swift +++ b/checkbox/Checkbox.swift @@ -138,8 +138,9 @@ open class Checkbox: UIControl { /// **Default:** `true` @IBInspectable public var useHapticFeedback: Bool = true - @available(tvOS, unavailable) + #if !os(tvOS) private var feedbackGenerator: UIImpactFeedbackGenerator? + #endif // MARK: - Lifecycle public override init(frame: CGRect) { @@ -161,10 +162,12 @@ open class Checkbox: UIControl { let tapGesture = UITapGestureRecognizer(target: self, action: #selector(handleTapGesture(recognizer:))) addGestureRecognizer(tapGesture) + #if !os(tvOS) if useHapticFeedback, #available(iOS 11, *), #available(macOS 13, *) { feedbackGenerator = UIImpactFeedbackGenerator(style: .light) feedbackGenerator?.prepare() } + #endif } override public func draw(_ rect: CGRect) { @@ -303,11 +306,13 @@ open class Checkbox: UIControl { sendActions(for: .valueChanged) if useHapticFeedback { + #if !os(tvOS) // Trigger impact feedback. feedbackGenerator?.impactOccurred() // Keep the generator in a prepared state. feedbackGenerator?.prepare() + #endif } } From 2bd912dce50f5f83df318c88195832e7fa7b493b Mon Sep 17 00:00:00 2001 From: Roman Podymov Date: Sat, 7 Oct 2023 22:09:01 +0200 Subject: [PATCH 2/2] 11.0 --- CheckboxDemo.xcodeproj/project.pbxproj | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/CheckboxDemo.xcodeproj/project.pbxproj b/CheckboxDemo.xcodeproj/project.pbxproj index 9a81176..7ed5104 100644 --- a/CheckboxDemo.xcodeproj/project.pbxproj +++ b/CheckboxDemo.xcodeproj/project.pbxproj @@ -301,7 +301,6 @@ GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = SimpleCheckbox/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MARKETING_VERSION = 2.1.0; PRODUCT_BUNDLE_IDENTIFIER = beaunouvelle.SimpleCheckbox; @@ -331,7 +330,6 @@ GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = SimpleCheckbox/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MARKETING_VERSION = 2.1.0; PRODUCT_BUNDLE_IDENTIFIER = beaunouvelle.SimpleCheckbox; @@ -395,12 +393,13 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.3; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + TVOS_DEPLOYMENT_TARGET = 11.0; }; name = Debug; }; @@ -449,10 +448,11 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.3; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + TVOS_DEPLOYMENT_TARGET = 11.0; VALIDATE_PRODUCT = YES; }; name = Release; @@ -467,7 +467,6 @@ CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = "$(SRCROOT)/demo/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MARKETING_VERSION = 2.1.0; PRODUCT_BUNDLE_IDENTIFIER = com.checkbox.Checkbox; @@ -487,7 +486,6 @@ CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = "$(SRCROOT)/demo/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MARKETING_VERSION = 2.1.0; PRODUCT_BUNDLE_IDENTIFIER = com.checkbox.Checkbox;