From b96d6cdeed263cb0739bf8441ea953822183ead3 Mon Sep 17 00:00:00 2001 From: Alexander Chapliuk Date: Thu, 23 Feb 2023 11:49:03 +0100 Subject: [PATCH 1/3] Use Xcode 14 minimal deployment target (iOS 11) --- Package.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Package.swift b/Package.swift index 066ddfd..374ce03 100644 --- a/Package.swift +++ b/Package.swift @@ -6,9 +6,9 @@ import PackageDescription let package = Package( name: "WrappingStack", platforms: [ - .iOS(.v9), + .iOS(.v11), .watchOS(.v6), - .tvOS(.v13), + .tvOS(.v11), .macOS(.v10_10) ], products: [ From 9419683e7c4ce16053c8e84b16d2967e0aa9b041 Mon Sep 17 00:00:00 2001 From: Alexander Chapliuk Date: Thu, 23 Feb 2023 11:50:22 +0100 Subject: [PATCH 2/3] Make component available on tvOS --- Sources/WrappingStack/Helpers/SizeReader.swift | 6 +++--- .../WrappingStack/Helpers/TightHeightGeometryReader.swift | 2 +- Sources/WrappingStack/WrappingHStack.swift | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Sources/WrappingStack/Helpers/SizeReader.swift b/Sources/WrappingStack/Helpers/SizeReader.swift index cbc2c06..15a51eb 100644 --- a/Sources/WrappingStack/Helpers/SizeReader.swift +++ b/Sources/WrappingStack/Helpers/SizeReader.swift @@ -2,14 +2,14 @@ import SwiftUI -@available(iOS 14, macOS 11, *) +@available(iOS 14, tvOS 14, macOS 11, *) extension View { func onSizeChange(perform action: @escaping (CGSize) -> ()) -> some View { modifier(SizeReader(onChange: action)) } } -@available(iOS 14, macOS 11, *) +@available(iOS 14, tvOS 14, macOS 11, *) private struct SizeReader: ViewModifier { var onChange: (CGSize) -> () @@ -25,7 +25,7 @@ private struct SizeReader: ViewModifier { } } -@available(iOS 14, macOS 11, *) +@available(iOS 14, tvOS 14, macOS 11, *) private struct SizePreferenceKey: PreferenceKey { static var defaultValue: CGSize = .zero static func reduce(value: inout CGSize, nextValue: () -> CGSize) {} diff --git a/Sources/WrappingStack/Helpers/TightHeightGeometryReader.swift b/Sources/WrappingStack/Helpers/TightHeightGeometryReader.swift index 20aac2f..9f21f46 100644 --- a/Sources/WrappingStack/Helpers/TightHeightGeometryReader.swift +++ b/Sources/WrappingStack/Helpers/TightHeightGeometryReader.swift @@ -2,7 +2,7 @@ import SwiftUI -@available(iOS 14, macOS 11, *) +@available(iOS 14, tvOS 14, macOS 11, *) struct TightHeightGeometryReader: View { var alignment: Alignment @State private var height: CGFloat = 0 diff --git a/Sources/WrappingStack/WrappingHStack.swift b/Sources/WrappingStack/WrappingHStack.swift index 2ec306c..aa56889 100644 --- a/Sources/WrappingStack/WrappingHStack.swift +++ b/Sources/WrappingStack/WrappingHStack.swift @@ -3,7 +3,7 @@ import SwiftUI /// An HStack that grows vertically when single line overflows -@available(iOS 14, macOS 11, *) +@available(iOS 14, tvOS 14, macOS 11, *) public struct WrappingHStack: View { public let data: Data @@ -105,7 +105,7 @@ public struct WrappingHStack Date: Thu, 23 Feb 2023 12:01:09 +0100 Subject: [PATCH 3/3] Good-looking preview in both Color schemes --- Sources/WrappingStack/WrappingHStack.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Sources/WrappingStack/WrappingHStack.swift b/Sources/WrappingStack/WrappingHStack.swift index aa56889..055a636 100644 --- a/Sources/WrappingStack/WrappingHStack.swift +++ b/Sources/WrappingStack/WrappingHStack.swift @@ -142,14 +142,13 @@ struct WrappingHStack_Previews: PreviewProvider { ForEach(["Cat 🐱", "Dog 🐶", "Sun 🌞", "Moon 🌕", "Tree 🌳"], id: \.self) { element in Text(element) .padding() - .background(Color.gray.opacity(0.1)) + .background(Color.secondary.opacity(0.2)) .cornerRadius(6) .fixedSize() } } .padding() .frame(width: 300) - .background(Color.white) } }