Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deployment target 11+ and tvOS availability #11

Merged
merged 3 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down
6 changes: 3 additions & 3 deletions Sources/WrappingStack/Helpers/SizeReader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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) -> ()

Expand All @@ -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) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import SwiftUI

@available(iOS 14, macOS 11, *)
@available(iOS 14, tvOS 14, macOS 11, *)
struct TightHeightGeometryReader<Content: View>: View {
var alignment: Alignment
@State private var height: CGFloat = 0
Expand Down
9 changes: 4 additions & 5 deletions Sources/WrappingStack/WrappingHStack.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<Data: RandomAccessCollection, ID: Hashable, Content: View>: View {

public let data: Data
Expand Down Expand Up @@ -105,7 +105,7 @@ public struct WrappingHStack<Data: RandomAccessCollection, ID: Hashable, Content
}
}

@available(iOS 14, macOS 11, *)
@available(iOS 14, tvOS 14, macOS 11, *)
extension WrappingHStack where ID == Data.Element.ID, Data.Element: Identifiable {
/// Creates a new WrappingHStack
///
Expand All @@ -130,7 +130,7 @@ extension WrappingHStack where ID == Data.Element.ID, Data.Element: Identifiable

#if DEBUG

@available(iOS 14, macOS 11, *)
@available(iOS 14, tvOS 14, macOS 11, *)
struct WrappingHStack_Previews: PreviewProvider {
static var previews: some View {
WrappingHStack(
Expand All @@ -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)
}
}

Expand Down