If you want to move all the button logic on a class, use a class referenced from the view, this class should be a @StateObject variable, and you can call yourClass.method() when the button is tapped on.
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: