I have a utiltiy function that saves data to CoreData
.
func saveData(content: String) throws -> Void {
// saves a model to CoreData
}
I want to fire this function when a Button
is tapped by a user. Something like
Button(action: saveData)
But when I attempt this I get an error Invalid conversion from throwing function of type '() throws -> Void' to non-throwing function type '() -> Void'
.
Is it possible to do what I am imagining or is there some other best practice I should be doing?