This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
Hi there, A bit of a newbie Swift UI coder here.
I’m really enjoying playing around in building an app in Playgrounds.
I have the basic mechanism of the main game mostly worked out.
The trouble I’m having is that when the app runs, I have a splash screen, followed by a menu page (not sure if I’m using the word page correctly for Swift).
I want to make it that when the Play button on the menu page is touched, that the user is taken to a new window (view I assume), where I have a view that contains all the main game.
When I try call this view by simply putting the following in the buttons action, I get a warning that “Result of 'ContentView' initializer is unused”
ContentView()
I am so confused how to bring in the ContentView. Any help would be greatly appreciated. I am working my way through 100 days, but I’m also looking around at videos online to see if I can solve this issue in some way.
Am I perhaps not thinking about how views work in SwiftUI?
Or is it because I’m coding only in Swift Playground?
Should I be nesting my splash view, menu view and game view in a NavigationView and then I can call these views when needed?
Also I currently have the ContentView() as a separate swift file but in the same app in Playground, would that be causing the problem?
Any help is greatly appreciated, really feeling like I’m finding this way harder than it should be.
Subreddit
Post Details
- Posted
- 1 year ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/swift/comme...