sanzaru/SimpleToast

SimpleToast is blocking tvOS preview

Closed this issue · 2 comments

For a multi platform projects, we can conditional link it to exclude tvOS in building and also use #canImport in Swift code.

image

This works fine for building and archiving. However this will cause an issue when previewing SwiftUI view on tvOS.

== PREVIEW UPDATE ERROR:

    SchemeBuildError: Failed to build the scheme ”Forumate”
    
    'DragGesture' is unavailable in tvOS
    
    Compile SimpleToast.swift (arm64):
    /Users/kyle/Library/Developer/Xcode/DerivedData/Forumate-cfcvrozqvmyfrfcrzfasktaukvys/SourcePackages/checkouts/SimpleToast/Sources/SimpleToast/SimpleToast.swift:30:9: error: 'DragGesture' is unavailable in tvOS
            DragGesture()
            ^~~~~~~~~~~

At first, I was thinking adding a PR to add something like @unavaiable(tvOS) mark to SimpleToast. But later I find we can add tvOS support directly.

There are only 2 issues here:

  1. onTapGesture(count:) is supported on tvOS via tvOS 16.0 which is supported on Package manifest version 5.7.
  2. DragGesture is not available on tvOS. We can just use #if os(tvOS) to remove this feature.

If you are fine about it, I'm glad to add a pull request here. @sanzaru

@Kyle-Ye Thanks for your contribution. I reviewed your PR and left a comment.