Skip to content

Commit

Permalink
Deployment target 11+ and tvOS availability
Browse files Browse the repository at this point in the history
  • Loading branch information
diniska authored Sep 18, 2024
2 parents 69181f7 + 68b4324 commit 0571473
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
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

0 comments on commit 0571473

Please sign in to comment.