I would like to custom a View and add a function with closure.
Like this:
public func onTapGesture(count: Int = 1, perform action: @escaping () -> Void) -> some View
It appears as an error Cannot assign to property: 'self' is immutable when I declare a function, like this:
var onFinishedClosure: (() -> Void)?
func onFinished(perform action: @escaping () -> Void) -> some View {
self.onFinishedClosure = action
return self
}
Thanks for your help.