Skip to content

Commit 5f8571e

Browse files
update tvOS
1 parent 6d4f162 commit 5f8571e

File tree

6 files changed

+31
-4
lines changed

6 files changed

+31
-4
lines changed

Test Harness/NRTestApp/NRTestApp/Navigation/MainCoordinator.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,11 @@ class MainCoordinator: Coordinator {
4747
}
4848

4949
func showTextMaskingController() {
50+
#if os(iOS)
51+
5052
let webViewController = ViewControllerProvider.textMaskingViewController
5153
navigationController.pushViewController(webViewController, animated: true)
54+
#endif
5255
}
5356

5457
func showCollectionController() {

Test Harness/NRTestApp/NRTestApp/ViewControllers/ConfidentialViewController.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ class ConfidentialViewController: UIViewController {
1919
super.viewDidLoad()
2020

2121
self.title = "Confidential View"
22+
#if os(iOS)
2223
self.view.backgroundColor = .systemBackground
23-
24+
#endif
2425
setupUI()
2526
}
2627

@@ -86,7 +87,10 @@ class ConfidentialViewController: UIViewController {
8687

8788
private func createConfidentialContentSection() -> UIStackView {
8889
let containerView = UIView()
90+
#if os(iOS)
91+
8992
containerView.backgroundColor = .systemGray6
93+
#endif
9094
containerView.layer.cornerRadius = 12
9195
containerView.layer.borderWidth = 2
9296
containerView.layer.borderColor = UIColor.systemRed.cgColor

Test Harness/NRTestApp/NRTestApp/ViewControllers/DiffTestViewController.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@ class DiffTestViewController: UIViewController {
4141

4242
scrollView.translatesAutoresizingMaskIntoConstraints = false
4343
contentView.translatesAutoresizingMaskIntoConstraints = false
44+
45+
#if !os(tvOS)
4446
if #available(iOS 17.4, *) {
4547
scrollView.bouncesVertically = true
4648
}
47-
49+
#endif
4850
view.addSubview(scrollView)
4951
scrollView.addSubview(contentView)
5052
contentView.addSubview(textField)

Test Harness/NRTestApp/NRTestApp/ViewControllers/InfiniteImageCollectionViewController.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ class InfiniteImageCollectionViewController: UIViewController {
3939
layout.sectionInset = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10)
4040

4141
collectionView = UICollectionView(frame: view.bounds, collectionViewLayout: layout)
42+
#if os(iOS)
43+
4244
collectionView.backgroundColor = .systemBackground
45+
#endif
4346
collectionView.dataSource = self
4447
collectionView.delegate = self
4548
collectionView.register(ImageCollectionViewCell.self, forCellWithReuseIdentifier: "ImageCell")
@@ -123,7 +126,10 @@ class ImageCollectionViewCell: UICollectionViewCell {
123126

124127
imageView.contentMode = .scaleAspectFill
125128
imageView.clipsToBounds = true
129+
#if os(iOS)
130+
126131
imageView.backgroundColor = .systemGray6
132+
#endif
127133
imageView.layer.cornerRadius = 8
128134

129135
imageView.translatesAutoresizingMaskIntoConstraints = false

Test Harness/NRTestApp/NRTestApp/ViewControllers/InfiniteScrollViewController.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ class InfiniteScrollTableViewController: UIViewController {
3737
tableView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
3838

3939
// Set the background color
40+
#if os(iOS)
4041
tableView.backgroundColor = .systemBackground
42+
#endif
4143

4244
// Register a standard UITableViewCell
4345
tableView.register(UITableViewCell.self, forCellReuseIdentifier: reuseIdentifier)

Test Harness/NRTestApp/NRTestApp/ViewControllers/ScrollableCollectionViewController.swift

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ class ScrollableCollectionViewController: UIViewController {
3535
// Create and configure collection view
3636
collectionView = UICollectionView(frame: view.safeAreaLayoutGuide.layoutFrame, collectionViewLayout: layout)
3737
collectionView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
38+
#if os(iOS)
39+
3840
collectionView.backgroundColor = .systemBackground
41+
#endif
3942
collectionView.register(ColorCollectionViewCell.self, forCellWithReuseIdentifier: reuseIdentifier)
4043
collectionView.dataSource = self
4144
collectionView.delegate = self
@@ -76,9 +79,13 @@ class ColorCollectionViewCell: UICollectionViewCell {
7679

7780
override init(frame: CGRect) {
7881
// Create blur effect
82+
#if os(iOS)
83+
7984
let blurEffect = UIBlurEffect(style: .systemMaterial)
8085
blurEffectView = UIVisualEffectView(effect: blurEffect)
81-
86+
#else
87+
blurEffectView = UIVisualEffectView()
88+
#endif
8289
super.init(frame: frame)
8390

8491
// Configure cell appearance
@@ -96,13 +103,14 @@ class ColorCollectionViewCell: UICollectionViewCell {
96103
label.font = UIFont.boldSystemFont(ofSize: 16)
97104
label.translatesAutoresizingMaskIntoConstraints = false
98105

106+
#if os(iOS)
107+
99108
// Add label to the vibrancy effect view for better text rendering on blur
100109
let vibrancyEffect = UIVibrancyEffect(blurEffect: blurEffect)
101110
let vibrancyView = UIVisualEffectView(effect: vibrancyEffect)
102111
vibrancyView.frame = blurEffectView.bounds
103112
vibrancyView.contentView.addSubview(label)
104113
blurEffectView.contentView.addSubview(vibrancyView)
105-
106114
// Set up constraints for the label
107115
NSLayoutConstraint.activate([
108116
label.centerXAnchor.constraint(equalTo: vibrancyView.contentView.centerXAnchor),
@@ -112,6 +120,8 @@ class ColorCollectionViewCell: UICollectionViewCell {
112120
vibrancyView.topAnchor.constraint(equalTo: blurEffectView.topAnchor),
113121
vibrancyView.bottomAnchor.constraint(equalTo: blurEffectView.bottomAnchor)
114122
])
123+
#endif
124+
115125
}
116126

117127
required init?(coder: NSCoder) {

0 commit comments

Comments
 (0)