From dd0577fdbc91f7bfdeebeed5ee59481d7c4f6017 Mon Sep 17 00:00:00 2001 From: Stefano Bertagno Date: Tue, 22 Aug 2023 19:50:43 +0200 Subject: [PATCH] Remove reference to tvOS --- .../Collection/SystemImageCollection.swift | 8 ++++---- Sources/SystemImagePicker/Components/EmptyState.swift | 2 +- Sources/SystemImagePicker/Components/Wrapper.swift | 2 +- .../Styles/DefaultSystemImagePickerStyle.swift | 2 -- Sources/SystemImagePicker/SystemImagePicker.swift | 6 +++++- Tests/SystemImagePickerTests/SystemImagePickerTests.swift | 4 ++-- docs/README.md | 1 - 7 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Sources/SystemImagePicker/Collection/SystemImageCollection.swift b/Sources/SystemImagePicker/Collection/SystemImageCollection.swift index ffbdf5d..1719802 100644 --- a/Sources/SystemImagePicker/Collection/SystemImageCollection.swift +++ b/Sources/SystemImagePicker/Collection/SystemImageCollection.swift @@ -99,9 +99,9 @@ extension SystemImageCollection: Codable where Value == String { /// The version-specific default collection. public static let `default`: Self = { let url: URL? - if #available(iOS 17, macOS 14, tvOS 17, watchOS 10, *) { + if #available(iOS 17, macOS 14, watchOS 10, *) { url = Bundle.module.url(forResource: "symbols5", withExtension: "json") - } else if #available(iOS 16, macOS 13, tvOS 16, watchOS 9, *) { + } else if #available(iOS 16, macOS 13, watchOS 9, *) { url = Bundle.module.url(forResource: "symbols4", withExtension: "json") } else { url = Bundle.module.url(forResource: "symbols3", withExtension: "json") @@ -117,9 +117,9 @@ extension SystemImageCollection: Codable where Value == String { /// The version-specific **UNSECTIONED** default collection. public static let `unsectionedDefault`: Self = { let url: URL? - if #available(iOS 17, macOS 14, tvOS 17, watchOS 10, *) { + if #available(iOS 17, macOS 14, watchOS 10, *) { url = Bundle.module.url(forResource: "symbols5", withExtension: "txt") - } else if #available(iOS 16, macOS 13, tvOS 16, watchOS 9, *) { + } else if #available(iOS 16, macOS 13, watchOS 9, *) { url = Bundle.module.url(forResource: "symbols4", withExtension: "txt") } else { url = Bundle.module.url(forResource: "symbols3", withExtension: "txt") diff --git a/Sources/SystemImagePicker/Components/EmptyState.swift b/Sources/SystemImagePicker/Components/EmptyState.swift index ee5a0e8..12944da 100644 --- a/Sources/SystemImagePicker/Components/EmptyState.swift +++ b/Sources/SystemImagePicker/Components/EmptyState.swift @@ -18,7 +18,7 @@ struct EmptyState: View { var body: some View { #if compiler(>=5.9) // Adapt the empty state to the query. - if #available(iOS 17, macOS 14, watchOS 10, tvOS 17, *) { + if #available(iOS 17, macOS 14, watchOS 10, *) { if !query.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { ContentUnavailableView.search(text: query) .frame(maxWidth: .infinity, maxHeight: .infinity) diff --git a/Sources/SystemImagePicker/Components/Wrapper.swift b/Sources/SystemImagePicker/Components/Wrapper.swift index 65b4855..bd0f674 100644 --- a/Sources/SystemImagePicker/Components/Wrapper.swift +++ b/Sources/SystemImagePicker/Components/Wrapper.swift @@ -16,7 +16,7 @@ struct Wrapper: View { /// The underlying view. var body: some View { #if !os(macOS) - if #available(iOS 16, macOS 13, watchOS 9, tvOS 16, *) { + if #available(iOS 16, watchOS 9, *) { NavigationStack { content().navigationBarTitleDisplayMode(.inline) } diff --git a/Sources/SystemImagePicker/Styles/DefaultSystemImagePickerStyle.swift b/Sources/SystemImagePicker/Styles/DefaultSystemImagePickerStyle.swift index d62304b..d5a6a70 100644 --- a/Sources/SystemImagePicker/Styles/DefaultSystemImagePickerStyle.swift +++ b/Sources/SystemImagePicker/Styles/DefaultSystemImagePickerStyle.swift @@ -25,8 +25,6 @@ public extension SystemImagePickerStyle { 64 #elseif os(macOS) 48 - #elseif os(tvOS) - 128 #elseif compiler(>=5.9) && os(visionOS) 64 #else diff --git a/Sources/SystemImagePicker/SystemImagePicker.swift b/Sources/SystemImagePicker/SystemImagePicker.swift index 2c08f15..284b01f 100644 --- a/Sources/SystemImagePicker/SystemImagePicker.swift +++ b/Sources/SystemImagePicker/SystemImagePicker.swift @@ -8,6 +8,10 @@ import Foundation import SwiftUI +#if os(tvOS) +#error("SystemImagePicker is unavailable for tvOS. Please open up a discussion on the GitHub repo if it's a feature you need.") +#endif + /// A `struct` defining a picker utility to select /// a _SF Symbol_ within a collection. public struct SystemImagePicker: View { @@ -99,7 +103,7 @@ public struct SystemImagePicker: View { .frame(width: 16.0, height: 16.0) .contentShape(Circle()) } - .buttonStyle(.borderless) + .buttonStyle(.plain) } .padding() #endif diff --git a/Tests/SystemImagePickerTests/SystemImagePickerTests.swift b/Tests/SystemImagePickerTests/SystemImagePickerTests.swift index 399aced..97e0cb2 100644 --- a/Tests/SystemImagePickerTests/SystemImagePickerTests.swift +++ b/Tests/SystemImagePickerTests/SystemImagePickerTests.swift @@ -105,9 +105,9 @@ final class SystemImagePickerTests: XCTestCase { /// - throws: Any `Error`. private func loadSystemImages() throws -> Set { let url: URL? - if #available(iOS 17, macOS 14, tvOS 17, watchOS 10, *) { + if #available(iOS 17, macOS 14, watchOS 10, *) { url = Bundle.module.url(forResource: "symbols5", withExtension: "txt") - } else if #available(iOS 16, macOS 13, tvOS 16, watchOS 9, *) { + } else if #available(iOS 16, macOS 13, watchOS 9, *) { url = Bundle.module.url(forResource: "symbols4", withExtension: "txt") } else { url = Bundle.module.url(forResource: "symbols3", withExtension: "txt") diff --git a/docs/README.md b/docs/README.md index 58c2d6b..dc22e01 100644 --- a/docs/README.md +++ b/docs/README.md @@ -3,7 +3,6 @@ [![Swift](https://img.shields.io/badge/Swift-5.8-%23DE5C43?style=flat&logo=swift)](https://swift.org) ![iOS](https://img.shields.io/badge/iOS-15.0-34c759) ![macOS](https://img.shields.io/badge/macOS-12-34c759) -![tvOS](https://img.shields.io/badge/tvOS-15.0-34c759) ![watchOS](https://img.shields.io/badge/watchOS-8.0-34c759) ![visionOS](https://img.shields.io/badge/visionOS-1.0-34c759)