Skip to content

Commit

Permalink
Add tvOS support
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle-Ye committed Sep 9, 2023
1 parent 7ced9fe commit 5935514
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// swift-tools-version:5.2
// swift-tools-version:5.7
import PackageDescription

let package = Package(
name: "SimpleToast",
platforms: [
.iOS(.v13), .macOS(.v10_15)
.iOS(.v13), .macOS(.v10_15), .tvOS(.v16)
],
products: [
.library(
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![](https://tinyurl.com/3e9pprjv)](https://swiftpackageindex.com/sanzaru/SimpleToast)
[![](https://tinyurl.com/mtkte8as)](https://swiftpackageindex.com/sanzaru/SimpleToast)

SimpleToast is a simple, lightweight, flexible and easy to use library to show toasts / popup notifications inside iOS or MacOS applications in SwiftUI. Because of the flexibility to show any content it is also possible to use the library for showing simple modals.
SimpleToast is a simple, lightweight, flexible and easy to use library to show toasts / popup notifications inside iOS or macOS applications in SwiftUI. Because of the flexibility to show any content it is also possible to use the library for showing simple modals.

You decide the content, the library takes care about the rest.

Expand Down
9 changes: 8 additions & 1 deletion Sources/SimpleToast/SimpleToast.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ struct SimpleToast<SimpleToastContent: View>: ViewModifier {

private let maxDelta: CGFloat = 20

#if !os(tvOS)
/// Dimiss the toast on drag
private var dragGesture: some Gesture {
DragGesture()
Expand Down Expand Up @@ -71,6 +72,7 @@ struct SimpleToast<SimpleToastContent: View>: ViewModifier {
offset = .zero
}
}
#endif

@ViewBuilder
private var toastRenderContent: some View {
Expand All @@ -80,13 +82,16 @@ struct SimpleToast<SimpleToastContent: View>: ViewModifier {
case .slide:
toastInnerContent
.modifier(SimpleToastSlide(showToast: $showToast, options: options))
#if !os(tvOS)
.gesture(dragGesture)
#endif

case .scale:
toastInnerContent
.modifier(SimpleToastScale(showToast: $showToast, options: options))
#if !os(tvOS)
.gesture(dragGesture)

#endif
case .skew:
toastInnerContent
.modifier(SimpleToastSkew(showToast: $showToast, options: options))
Expand All @@ -100,7 +105,9 @@ struct SimpleToast<SimpleToastContent: View>: ViewModifier {
default:
toastInnerContent
.modifier(SimpleToastFade(showToast: $showToast, options: options))
#if !os(tvOS)
.gesture(dragGesture)
#endif
}
}
.onTapGesture(perform: dismissOnTap)
Expand Down

0 comments on commit 5935514

Please sign in to comment.