Skip to content

Commit

Permalink
Add tvOS support
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Pospesel authored and mpospese committed Sep 27, 2022
1 parent bdae470 commit 3109df6
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ let package = Package(
name: "YCoreUI",
defaultLocalization: "en",
platforms: [
.iOS(.v14)
.iOS(.v14),
.tvOS(.v14)
],
products: [
.library(
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ _Core components for iOS to accelerate building user interfaces in code._
This lightweight framework primarily comprises:

* UIView extensions for declarative Auto Layout
* UIScrollView extensions to assist with keyboard avoidance
* UIColor extensions for WCAG 2.0 contrast ratio calculations

* (iOS only) UIScrollView extensions to assist with keyboard avoidance

It also contains miscellaneous other Foundation and UIKit extensions.

Documentation
Expand Down
2 changes: 2 additions & 0 deletions Sources/YCoreUI/Components/FormViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import UIKit

#if os(iOS)
/// A view controller with a scrollable content area that will automatically avoid the keyboard for you.
/// A good choice for views that have inputs (e.g. login or onboarding).
open class FormViewController: UIViewController {
Expand Down Expand Up @@ -154,3 +155,4 @@ internal extension FormViewController {
handleTapOutside()
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import UIKit

#if os(iOS)
extension UIScrollView {
/// Enables form functionality (content avoids keyboard, sets interactive dismiss mode).
/// This calls `registerKeyboardNotifications`
Expand Down Expand Up @@ -130,3 +131,4 @@ internal extension UIScrollView {
return UIView.AnimationOptions(rawValue: animationCurve.uintValue << 16)
}
}
#endif
2 changes: 2 additions & 0 deletions Tests/YCoreUITests/Components/FormViewControllerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import XCTest
@testable import YCoreUI

#if os(iOS)
final class FormViewControllerTests: XCTestCase {
func testLoadView() {
let sut = makeSUT()
Expand Down Expand Up @@ -151,3 +152,4 @@ final class MockFormViewController: FormViewController {
didTapOutside = true
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import XCTest
@testable import YCoreUI

#if os(iOS)
final class UIScrollViewKeyboardNotificationsTests: XCTestCase {
func testShowKeyboard() {
let sut = makeSUT()
Expand Down Expand Up @@ -161,3 +162,4 @@ private extension UIScrollViewKeyboardNotificationsTests {
RunLoop.current.run(until: Date())
}
}
#endif

0 comments on commit 3109df6

Please sign in to comment.