Timer app renaming struct error

I am trying to create a timer that counts down so I can implement it to a app I am creating, here is a demo project:

The error I am facing is that when I change the struct name to something other then ContentView() I get this error:

But if the struct is ContentView() I get no error:

What can I do so I can name the struct something other then ContentView() and not get any errors (Like if I want to name the struct Timer() what should I do)?


Don’t call it Timer. That name is already in use by the Timer provided by Foundation so you’re causing a conflict and confusing the compiler.

Instead, call your struct TimerView or something like that.

And that just makes sense semantically anyway. Your struct is not a timer, it is a View that displays a Timer’s current value.

1 Like