Group Group Group Group Group Group Group Group Group

Challenge: Extract Views | raywenderlich.com


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/18176818-your-first-ios-and-swiftui-app-polishing-the-app/lessons/7

At the 3:05 mark, where Ray is just starting to scroll up, you can see the two Structs, InstructionsView and SliderView.

Why is it that in InstructionsView we reference the Binded variable “game” as just game on line 62, but for SliderView, we reference the Binded variable “sliderValue” as $sliderValue with a $(dollar sign)?

Good question! The difference is:

  • In InstructionsView you are accessing the target property (variable) on game. To access a property you don’t need the $.
  • In SliderView you are passing a reference to sliderValue to another view, as a binding. To pass a binding as a reference you need the $.

I hope that helps!

It does help.

Thank you!