UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

How to use a swipe gesture on Apple TV with a Siri remote? SwiftUI Xcode 13

Forums > tvOS

Hello I'm brand new here. (brand new to code as well for that matter) so I apologize in advance if I'm doing this incorectly or asking a dumb question.

I've created a custom view which I would like to modify based on a swipe gesture on the siri remote. I've searched for hours to find a solution and cant find anything.

It's incredible to me that there dosen't seem to be a simple default solution for this.

eg:

@State var text: String = "some text"

some view {

Text(text) .focusable .onSwipe(swipe: .left) { text = "new text" } }

// a swipe left on the siri remote results in the text changing from "some text" to "new text"

this is a simplified version of what I would like to accomplish and obviously it doesn’t work. i'ts ok if the answer is more complicated and less elegant. I just want some way to achieve the same result.

Many thanks in advance for any answers or pointers!

5      

BUILD THE ULTIMATE PORTFOLIO APP Most Swift tutorials help you solve one specific problem, but in my Ultimate Portfolio App series I show you how to get all the best practices into a single app: architecture, testing, performance, accessibility, localization, project organization, and so much more, all while building a SwiftUI app that works on iOS, macOS and watchOS.

Get it on Hacking with Swift+

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.