Long button tap on LiveActivity

33 Views Asked by At

There is a LiveActivity on the LockScreen, and there is a button on it. It is necessary that the user can perform a long tap on the button, the circle around the button will fill and the application will open. I use the AppIntent protocol and the perform function. Maybe there are people who have experience working with similar situations?

Code Fragment with AppIntent protocol:

@available(iOS 16.2, *)
struct DisableIntent: AppIntent {
    
    static var title: LocalizedStringResource = "title"
    static var description = IntentDescription("description")
    
    public init() {}
    
    func perform() async throws -> some IntentResult {
        tapPrint()
        return .result()
    }
    
    func tapPrint() {
        print("tap registered")
    }
}

I tried to somehow connect the timer, but to no avail. I tried to use closure inside, but that didn't help either. I tried to use different types of return value of the perform function (we are talking about .result()), but did not find a suitable one.

0

There are 0 best solutions below