diff --git a/Flow.xcodeproj/project.pbxproj b/Flow.xcodeproj/project.pbxproj index a9dbf17..aa8e540 100644 --- a/Flow.xcodeproj/project.pbxproj +++ b/Flow.xcodeproj/project.pbxproj @@ -636,8 +636,9 @@ PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = ""; SKIP_INSTALL = YES; - SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx"; + SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvos appletvsimulator"; SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2,3"; }; name = Debug; }; @@ -661,8 +662,9 @@ PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = ""; SKIP_INSTALL = YES; - SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx"; + SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvos appletvsimulator"; SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2,3"; }; name = Release; }; @@ -675,8 +677,9 @@ PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = ""; - SUPPORTED_PLATFORMS = "macosx iphonesimulator iphoneos"; + SUPPORTED_PLATFORMS = "macosx iphonesimulator iphoneos appletvos appletvsimulator"; SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2,3"; }; name = Debug; }; @@ -689,8 +692,9 @@ PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = ""; - SUPPORTED_PLATFORMS = "macosx iphonesimulator iphoneos"; + SUPPORTED_PLATFORMS = "macosx iphonesimulator iphoneos appletvos appletvsimulator"; SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2,3"; }; name = Release; }; diff --git a/Flow/UIControls+Extensions.swift b/Flow/UIControls+Extensions.swift index 2170dbb..7e6c126 100644 --- a/Flow/UIControls+Extensions.swift +++ b/Flow/UIControls+Extensions.swift @@ -62,6 +62,21 @@ extension UIButton: SignalProvider { } } +extension UISegmentedControl: SignalProvider { + public var providedSignal: ReadWriteSignal { + return signal(for: .valueChanged, keyPath: \.selectedSegmentIndex) + .distinct() // KVO seems to trigger when tapping as well, even when tapping selected. + } +} + +extension UIPageControl: SignalProvider { + public var providedSignal: ReadWriteSignal { + return signal(for: .valueChanged, keyPath: \.currentPage) + } +} + +#if !os(tvOS) + extension UISwitch: SignalProvider { public var providedSignal: ReadWriteSignal { return signal(for: .valueChanged, keyPath: \.isOn) @@ -74,13 +89,6 @@ extension UISlider: SignalProvider { } } -extension UISegmentedControl: SignalProvider { - public var providedSignal: ReadWriteSignal { - return signal(for: .valueChanged, keyPath: \.selectedSegmentIndex) - .distinct() // KVO seems to trigger when tapping as well, even when tapping selected. - } -} - extension UIRefreshControl: SignalProvider { public var providedSignal: Signal<()> { return signal(for: .valueChanged) @@ -114,11 +122,7 @@ extension UIDatePicker: SignalProvider { } } -extension UIPageControl: SignalProvider { - public var providedSignal: ReadWriteSignal { - return signal(for: .valueChanged, keyPath: \.currentPage) - } -} +#endif extension UIBarItem: Enablable {} @@ -195,11 +199,15 @@ public extension UITextField { } } +#if !os(tvOS) + /// Returns a signal that will signal on orientation changes. public var orientationSignal: ReadSignal { return NotificationCenter.default.signal(forName: .UIApplicationDidChangeStatusBarOrientation).map { _ in UIApplication.shared.statusBarOrientation }.readable(capturing: UIApplication.shared.statusBarOrientation) } +#endif + private extension UITextField { class TextFieldDelegate: NSObject, UITextFieldDelegate { var shouldEndEditing = Delegate() diff --git a/Flow/UIView+EditingMenu.swift b/Flow/UIView+EditingMenu.swift index d7be760..024d811 100644 --- a/Flow/UIView+EditingMenu.swift +++ b/Flow/UIView+EditingMenu.swift @@ -6,7 +6,7 @@ // Copyright © 2015 iZettle. All rights reserved. // -#if canImport(UIKit) +#if canImport(UIKit) && !os(tvOS) import UIKit diff --git a/FlowFramework.podspec b/FlowFramework.podspec index a89780b..0957633 100644 --- a/FlowFramework.podspec +++ b/FlowFramework.podspec @@ -12,6 +12,7 @@ Pod::Spec.new do |s| s.osx.deployment_target = "10.11" s.ios.deployment_target = "9.0" + s.tvos.deployment_target = "9.0" s.source = { :git => "https://github.com/iZettle/Flow.git", :tag => "#{s.version}" } s.source_files = "Flow/*.{swift}"