Is this possible?
I have a class/struct that will store a function that will be used as an action to the button.
e.g.
struct Test {
var action: (() -> Void)?
}
This works
tempfunc() -> Void {
print("clicked it")
}
let test = Test()
test.action = tempfunc
Button("click me", action: test.action)
What I want to do is something like this.
test.action = () -> Void {
print("clicked")
}
Is this possible? If i try that code, error shows up saying "Cannot assign value of type '()' to type '() -> Void'"