0

I am trying to implement Toggle Switch as you see in the picture below, but I obtain the following error (the part on light red in the picture) using Xcode 14 and macOS 12.6.3: enter image description here

I am refering also to the apple documentation https://developer.apple.com/documentation/swiftui/toggle/init(_:sources:ison:)-39rkx

But it gives the same code. I would appreciate an idea on how to fix it. Thank you!

  • 1
    Please see [ask] -- the section on why to include code as text and not an image – jnpdx Mar 14 '23 at 21:23
  • 2
    Rename the struct `Toggle`. It clashes with the built-in type. And remove `Text(` – vadian Mar 14 '23 at 21:23
  • Does this answer your question? [TextField ViewModifier not conforming to ViewModifier?](https://stackoverflow.com/questions/71698728/textfield-viewmodifier-not-conforming-to-viewmodifier) – lorem ipsum Mar 14 '23 at 21:46

0 Answers0