Skip to content

Commit

Permalink
Merge pull request #40 from RomanPodymov/master
Browse files Browse the repository at this point in the history
tvOS
  • Loading branch information
BeauNouvelle committed Oct 9, 2023
2 parents 2dc6940 + 2bd912d commit d7fa095
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
10 changes: 4 additions & 6 deletions CheckboxDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
};
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import PackageDescription
let package = Package(
name: "SimpleCheckbox",
platforms: [
.iOS(.v11)
.iOS(.v11),
.tvOS(.v11)
],
products: [
.library(
Expand Down
3 changes: 2 additions & 1 deletion SimpleCheckbox.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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}" }

Expand Down
7 changes: 6 additions & 1 deletion checkbox/Checkbox.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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
}
}

Expand Down

0 comments on commit d7fa095

Please sign in to comment.