From bfcdef2fdb304bbf4c2dd7adf90f357febdb075e Mon Sep 17 00:00:00 2001
From: dscyrescotti
Date: Sat, 10 Sep 2022 19:23:07 +0630
Subject: [PATCH 1/2] feat: update readme
---
README.md | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 63c043f..22e0b2b 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
**ShuffleIt** is a user interface library for **SwiftUI** which delivers a collection of customizable stack views with a wide range of elegant shuffling, sliding and swiping behaviours.
@@ -58,7 +76,7 @@ dependencies: [
### Documentation
**ShuffleIt** provides a clear documentation to increase the familiarity with the API and shallow learning curve when using it. You can check it out via this [link](https://dscyrescotti.github.io/ShuffleIt/documentation/shuffleit/).
-### Demo
+### Demo Project
**ShuffleIt** also comes with the demo project which is an optimal spot to explore the API usage for available stack views. To run the demo project, you can use the following commands in your terminal.
```
> git clone https://github.com/dscyrescotti/ShuffleIt.git
From a3e60ba06519a81c9a592f103204443242da26a7 Mon Sep 17 00:00:00 2001
From: dscyrescotti
Date: Sat, 10 Sep 2022 19:38:37 +0630
Subject: [PATCH 2/2] feat: fix tvOS build failure
---
.../ShuffleStack/EnvironmentValues/ShuffleDiabled.swift | 4 ++++
.../ShuffleIt/ShuffleStack/Extensions/View+Extension.swift | 2 ++
.../ShuffleIt/ShuffleStack/View/ShuffleStack+Gesture.swift | 2 ++
Sources/ShuffleIt/ShuffleStack/View/ShuffleStack.swift | 6 ++++++
4 files changed, 14 insertions(+)
diff --git a/Sources/ShuffleIt/ShuffleStack/EnvironmentValues/ShuffleDiabled.swift b/Sources/ShuffleIt/ShuffleStack/EnvironmentValues/ShuffleDiabled.swift
index 3ad162a..ac5e196 100644
--- a/Sources/ShuffleIt/ShuffleStack/EnvironmentValues/ShuffleDiabled.swift
+++ b/Sources/ShuffleIt/ShuffleStack/EnvironmentValues/ShuffleDiabled.swift
@@ -1,11 +1,15 @@
import SwiftUI
/// An environment key for a flag to decide on whether shuffling is disable or not.
+@available(iOS 15.0, macOS 12.0, watchOS 8.0, *)
+@available(tvOS, unavailable)
struct ShuffleDisabledKey: EnvironmentKey {
static var defaultValue: Bool = false
}
extension EnvironmentValues {
+ @available(iOS 15.0, macOS 12.0, watchOS 8.0, *)
+ @available(tvOS, unavailable)
var shuffleDisabled: Bool {
get { self[ShuffleDisabledKey.self] }
set { self[ShuffleDisabledKey.self] = newValue }
diff --git a/Sources/ShuffleIt/ShuffleStack/Extensions/View+Extension.swift b/Sources/ShuffleIt/ShuffleStack/Extensions/View+Extension.swift
index 1af2730..32074c5 100644
--- a/Sources/ShuffleIt/ShuffleStack/Extensions/View+Extension.swift
+++ b/Sources/ShuffleIt/ShuffleStack/Extensions/View+Extension.swift
@@ -73,6 +73,8 @@ public extension View {
/// ```
/// - Parameter disabled: A boolean value to decide whether it should be disabled or not.
/// - Returns: A view with the given boolean.
+ @available(iOS 15.0, macOS 12.0, watchOS 8.0, *)
+ @available(tvOS, unavailable)
func swipeDisabled(_ disabled: Bool) -> some View {
environment(\.shuffleDisabled, disabled)
}
diff --git a/Sources/ShuffleIt/ShuffleStack/View/ShuffleStack+Gesture.swift b/Sources/ShuffleIt/ShuffleStack/View/ShuffleStack+Gesture.swift
index 3af0223..11e4ab5 100644
--- a/Sources/ShuffleIt/ShuffleStack/View/ShuffleStack+Gesture.swift
+++ b/Sources/ShuffleIt/ShuffleStack/View/ShuffleStack+Gesture.swift
@@ -2,6 +2,8 @@ import SwiftUI
extension ShuffleStack {
/// A drag gesture that listens gesture state on content views and calculates rotation and position for shuffling.
+ @available(iOS 15.0, macOS 12.0, watchOS 8.0, *)
+ @available(tvOS, unavailable)
internal var dragGesture: some Gesture {
DragGesture()
.updating($isActiveGesture, body: { _, state, _ in
diff --git a/Sources/ShuffleIt/ShuffleStack/View/ShuffleStack.swift b/Sources/ShuffleIt/ShuffleStack/View/ShuffleStack.swift
index 419f85f..02da0ac 100644
--- a/Sources/ShuffleIt/ShuffleStack/View/ShuffleStack.swift
+++ b/Sources/ShuffleIt/ShuffleStack/View/ShuffleStack.swift
@@ -69,7 +69,9 @@ import ViewInspector
public struct ShuffleStack: View where Data.Index == Int {
@Environment(\.shuffleStyle) internal var style
@Environment(\.shuffleAnimation) internal var animation
+ #if !os(tvOS)
@Environment(\.shuffleDisabled) internal var disabled
+ #endif
@Environment(\.shuffleTrigger) internal var shuffleTrigger
@Environment(\.stackOffset) internal var offset
@Environment(\.stackPadding) internal var padding
@@ -99,12 +101,16 @@ public struct ShuffleStack: Vi
Group {
leftContent
rightContent
+ #if os(tvOS)
+ mainContent
+ #else
if disabled {
mainContent
} else {
mainContent
.gesture(dragGesture)
}
+ #endif
}
.background {
GeometryReader { proxy in