Skip to content

Commit 3109df6

Browse files
Mark Pospeselmpospese
Mark Pospesel
authored andcommitted
Add tvOS support
1 parent bdae470 commit 3109df6

File tree

6 files changed

+12
-3
lines changed

6 files changed

+12
-3
lines changed

Package.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ let package = Package(
66
name: "YCoreUI",
77
defaultLocalization: "en",
88
platforms: [
9-
.iOS(.v14)
9+
.iOS(.v14),
10+
.tvOS(.v14)
1011
],
1112
products: [
1213
.library(

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ _Core components for iOS to accelerate building user interfaces in code._
55
This lightweight framework primarily comprises:
66

77
* UIView extensions for declarative Auto Layout
8-
* UIScrollView extensions to assist with keyboard avoidance
98
* UIColor extensions for WCAG 2.0 contrast ratio calculations
10-
9+
* (iOS only) UIScrollView extensions to assist with keyboard avoidance
10+
1111
It also contains miscellaneous other Foundation and UIKit extensions.
1212

1313
Documentation

Sources/YCoreUI/Components/FormViewController.swift

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import UIKit
1010

11+
#if os(iOS)
1112
/// A view controller with a scrollable content area that will automatically avoid the keyboard for you.
1213
/// A good choice for views that have inputs (e.g. login or onboarding).
1314
open class FormViewController: UIViewController {
@@ -154,3 +155,4 @@ internal extension FormViewController {
154155
handleTapOutside()
155156
}
156157
}
158+
#endif

Sources/YCoreUI/Extensions/UIKit/UIScrollView+keyboardNotifications.swift

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import UIKit
1010

11+
#if os(iOS)
1112
extension UIScrollView {
1213
/// Enables form functionality (content avoids keyboard, sets interactive dismiss mode).
1314
/// This calls `registerKeyboardNotifications`
@@ -130,3 +131,4 @@ internal extension UIScrollView {
130131
return UIView.AnimationOptions(rawValue: animationCurve.uintValue << 16)
131132
}
132133
}
134+
#endif

Tests/YCoreUITests/Components/FormViewControllerTests.swift

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import XCTest
1010
@testable import YCoreUI
1111

12+
#if os(iOS)
1213
final class FormViewControllerTests: XCTestCase {
1314
func testLoadView() {
1415
let sut = makeSUT()
@@ -151,3 +152,4 @@ final class MockFormViewController: FormViewController {
151152
didTapOutside = true
152153
}
153154
}
155+
#endif

Tests/YCoreUITests/Extensions/UIKit/UIScrollView+keyboardNotificationsTests.swift

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import XCTest
1010
@testable import YCoreUI
1111

12+
#if os(iOS)
1213
final class UIScrollViewKeyboardNotificationsTests: XCTestCase {
1314
func testShowKeyboard() {
1415
let sut = makeSUT()
@@ -161,3 +162,4 @@ private extension UIScrollViewKeyboardNotificationsTests {
161162
RunLoop.current.run(until: Date())
162163
}
163164
}
165+
#endif

0 commit comments

Comments
 (0)