What tutorial? Perhaps you've not copied the code correctly, or have missed something out. And, please format your code correctly. Three backticks before your code, and three afterwards, i.e. ALL of my code is within the two lines of backticks.
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: