Can someone please tell me how I am failing here?
I have a Struct
called cardView
, in which I predefine an option called currentIndex
and define it as an Integer
.
When I from a function inside my struct
try to add to currentIndex
I get a compiler error as the topic says.
Here's how it looks:
struct cardView {
var currentIndex: Int = 0
func addToIndex() {
currentIndex++
}
}
The cardView
struct and function is initialized from my viewController
.