I have a simple function to return either Text or Button, but I get the following error:
Function declares an opaque return type, but the return statements in its body do not have matching underlying types
Here's my function:
private func cellContent(for cell: Cell) -> some View {
if (cell.editable) {
return Button(action: { print("hi") }) { Text(cell.content) }
}
return Text(cell.content)
}
How can I fix this or do it different way?