Thank you note for help

I will get on trying this this and the videos, hopefully I can get it

1)Since I am doing the button to navigate instead of Navigation Link, and I put to go to the about us view between the braces as you said, why isn’t the button working
2)Do I still need all the isShowingAboutUsView stuff if I’m just going to be using the button
3)This is the only thing I am focused on right now, that’s why I am giving my all to it. I just have three things missing

For the purpose of the exercise, create a new SwiftUI App and call it “Test” or whatever you like and paste the following code in place of the code that is currently in ContentView.

import SwiftUI

struct ContentView: View {
    @State private var isShowingAboutUsView = false

    var body: some View {
        NavigationView {
            ZStack {
                Image("birthday")
                    .resizable()
                    .scaledToFill()
                    .edgesIgnoringSafeArea(.all)


                VStack(alignment: .center) {
                    Spacer()
                    Text("Welcome to Smilon!!")
                        .font(.largeTitle)
                        .fontWeight(.bold)
                        .foregroundColor(Color.black)
                        .multilineTextAlignment(.center)

                    Spacer()

                    Button("Join") {
                        // Go to AboutUs View
                        isShowingAboutUsView = true
                    }
                    .padding(.all)
                    .shadow(radius: 2)
                    .font(.title)
                    .foregroundColor(Color.black)

                    Spacer()

                    Text("By tapping Join, you agree to our privacy policy")
                        .fontWeight(.bold)
                        .foregroundColor(Color.black)
                        .padding(.all)

                }
            }
            .navigationTitle("Smilon App")
        }
        .fullScreenCover(isPresented: $isShowingAboutUsView) {
            AboutUsView(isShowingAboutUsView: $isShowingAboutUsView)
        }
    }
}


struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

Then create a second SwiftUI View file and name it AboutUsView and replace the contents of that with this code:

import SwiftUI

struct AboutUsView: View {
    @Binding var isShowingAboutUsView: Bool
    var body: some View {
        VStack {
            Spacer()
            Text("About Us View")
            Spacer()
            Button {
                isShowingAboutUsView = false
            } label: {
                ZStack {
                    RoundedRectangle(cornerRadius: 10)
                        .fill(Color.red)
                    Text("Dismiss")
                        .bold()
                        .foregroundColor(.white)

                }
                .frame(width: 260, height: 50)
            }
        }
    }
}

struct AboutUsView_Previews: PreviewProvider {
    static var previews: some View {
        AboutUsView(isShowingAboutUsView: .constant(false))
    }
}

Now have a look at the ContentView code.
Up the top there is a @State property named isShowingAboutUsView and that is set to false as the initial state.

Down the bottom is the .fullScreenCover modifier code. ie:

.fullScreenCover(isPresented: $isShowingAboutUsView) {
    AboutUsView(isShowingAboutUsView: $isShowingAboutUsView)
}

The isPresented parameter requires a Binding boolean value to trigger it so that value in this case is isShowingAboutUsView and the $ sign in front of it designates it as a binding value. The AboutUsView is presented when that binding value is set to true.

So take a look at the code I have placed in the Button closure (between the opening and closing braces { } )
I have set isShowingAboutUsView = true

So when you tap the button “Join”, it triggers the AboutUsView to slide up from the bottom of the screen and cover the current View.

When you tap on the Dismiss button in the AboutUsView, the AboutUsView slides back down and the previous view becomes visible again.

Don’t worry too much about the code in AboutUsView for the moment. I just wanted you to be able to Dismiss that View by tapping on the Dismiss button. What I am trying to get across to you is the mechanics of what you need to do to present another view. It is vital that you understand this concept.

Okay, i’ll test it out tomorrow

I just tried it on the other file I have and it’s kind of working!!

Oh okay, I’m starting to understand it more. I just tested it out and it worked. A couple of things

  1. Is for each screen that I want to show/navigate through, on the previous screen I have to have that code in order for the button to work right?
    2)Is this going to be the file I am now going to use for my app instead of the one I had before, that’s fine if it is then I can just copy and paste what i need over to the new file and we can work through together
    3)Is the content view the same as the welcome view

To be honest with you I think you are far too focussed on trying to create an App for yourself when you really have not gained sufficient knowledge of how to structure an App and how SwiftUI works. I mean it’s great that you want to create your own App but what you need to do first is get a thorough understanding of the Swift programming language and SwiftUI.

It’s taken me years to get where I am in iOS knowledge and I do not claim to be an expert. I’ve learned from many people including Chris Ching, Mark Moeykens, Paul Hudson, Sean Allen and many others who provide tutorials on YouTube.

So I really encourage you to do more courses and tutorials to get really comfortable with SwiftUI because at the moment your questions are on basic things that you need to master before you can even think about creating an App.

As a number of us have said may times, go back over the “14 Day Beginner Challenge (SwiftUI)” course and then do the " iOS Foundations (SwiftUI)" course which covers more complex techniques that you will find very useful in helping you to build your App.

1 Like

Can you please answer my questions?

Do i need to add @State private var isShowingAboutUsView = false part for each screen on the content view

Overall yes, but you should name your variable accordingly, don’t call it isShowingAboutUsView on every single view

Yes

No you apply the concepts from Chris into your own code

I think so. It’s just the name of a struct The name you’re giving your view.

Again as Chris mentioned you MUST learn the basics before doing anything advanced or you’ll be more confused

And this, @kiki21a , is exactly why several of us have repeatedly stressed that you need to step back from this app and learn/refresh the basics before continuing.

You keep wanting someone to hand you a solution you can just plug into your code when what you really need is to really understand why you are having a particular issue and how someone else solves it so that you can apply the concepts and principles in a way that makes sense for your specific code.

If you don’t learn these concepts and principles, your coding journey will be full of nothing but pain and frustration because the issues you are having will not just go away. And while there are resources, like these forums, to help when you run into problems, they are not substitutes for learning and experience; they are guides and aides. (Not to mention that an important part of asking for help is listening to the answers and accepting advice, not just getting frustrated and repeating “please answer my question” when you don’t get the answer you are looking for.)

Look, we’ve all been where you are, we all started somewhere, we all have had growing pains and issues along the way. And we all have had to recognize when we just don’t understand how to do something and need to stop and take a deeper dive into a concept that is giving us trouble. For instance, I seem to have some kind of mental block that interferes with me understanding SwiftUI’s alignmentGuide modifier. I’ve been using SwiftUI for more than 2 years now and have tried to grok that modifier several times and it’s not until just this morning that I think I’ve finally cracked that nut. (We’ll have to see if it sticks, though.) There’s no shame in not understanding something.

I understand and thank you all you guys for your help. I know me best so i’ll keeping working on it.

I am understanding everything a lot clearly now! I have a couple of questions
1)Do I need that navigation view code on every screen or is it only on the first screen
2) I did everything as you told me from the previous message and from the about us screen it’s not taking me to the next screen, ill show you the code
3) For some reason when I click the button on one of the screens, it’s sticking

This is my about us code


struct AboutUsView: View {
  
    @State private var isShowingEventView = false
    @Binding var isShowingAboutUsView: Bool
    var body: some View {
    
        VStack {
            Spacer()
            Text("About Us")
                .font(.largeTitle)
                .fontWeight(.semibold)
                .multilineTextAlignment(.center)
            
            Text("Did you know that you share your birthday with over 20.8 million people in the world. And you also share your anniversary and baptism day with so many people. I bet you haven't met one person with the same birthday,baptism or anniversary as you. That's why we created smilon so you connect, message and get personalzied messages from people around the world or in the U.S. So you and other can feel loved on your special day")
                .font(.body)
                .multilineTextAlignment(.center)
                .padding(.all)
            Text("Smilon is a messaging app where you can send and receive messages on these special days from other people either around the world in the U.S. It is completely up to you which one you decide to do. No private information is needed, all we need from you is your Name and the day of your birthday, baptism or anniversary!! ")
                .font(.body)
                .multilineTextAlignment(.center)
                .padding(.all)
            Text("If you are ready to connect with other people, click Next to begin the process")
                .font(.headline)
            
            Spacer()
            
            Button("Next") {
                //go to Event view
                isShowingEventView = true
        }
            }
        
        .padding(.all)
        .font(.title)
        .shadow(radius: 2)
        .foregroundColor(Color.black)
            
        
.fullScreenCover(isPresented: $isShowingEventView) {
 EventView(isShowingEventView: $isShowingEventView)
      
}

    }
}

struct AboutUsView_Previews: PreviewProvider {
    static var previews: some View {
        AboutUsView(isShowingAboutUsView: .constant(false))
    }

You can’t present the AboutUsView and then the EventView and then any other Views in a “chaining” manner you are attempting to use. The reason being is that each View is stacked on top of each other and when you get to the end of the series of Views you are presenting you still have the last one on top with all the others underneath (even though you can’t see them).

I think by now you are starting to get the picture that this is not easy.

The Chat App is a great example of how to cycle through a series of screens in an OnBoarding fashion where those screens can present examples of what the App can do, an AboutUs screen (as in the example you have) and also a Terms and Conditions page. The user should be presented with those screens before they are given the opportunity to make the commitment to Join and provide their details.

There will be a link that the user can click on in the welcome screen to read the privacy policy

How many screens do you need to present as part of the “On Boarding” process?

Five screens, my app will have five screens: welcome, about us, event, message and end screen

For my message screen, I am wanting the user to pick between either World Wide or the U.S. but it’s not working.Here is the code

struct MessageView: View {
    // State variables to store the values of the TextField and DatePicker
        @State var name = ""
        @State var birthday = Date()
        @State var location = "World Wide,U.S."
        @State var message = ""
    
    var body: some View {
        Form {
            // Name
            Section(header: Text("Name")) {
                TextField("Enter Name", text: $name)
            }

            // Birthday
            Section(header: Text("Birthday")) {
                DatePicker("Special Day Date", selection: $birthday, in: ...Date(), displayedComponents: .date)
                // in: ...Date() refers to the range the user can select from
                // It wouldn't make sense if the user could select a date that hasn't happened yet
                // By default a DatePicker will let the user pick a time and date
                // displayedComponents: .date, restricts it to date selection only
                
                //Location
                Section(header: Text("Location")) {
                   TextField("World Wide or U.S", text: $location)
                
                // Message
                Section(header: Text("Message")) {
                    TextField("Enter your message", text: $message)
                        
    }
}
    }
}
                }
            }

struct MessageView_Previews: PreviewProvider {
    static var previews: some View {
        MessageView()
    }

The code you have provided inserts a text field for the user to type in their location.

If you want the user to pick from a drop down list of locations instead then you need to use a “Picker” instead of textField.
If you Google “swiftUI picker” then there will be some tutorials to help with pickers.

Once you’ve put the picker in then let us know if it doesn’t work and will try and help

Please post this as a topic on its own

To make it easier to understand and be able to mark a single question to have a single answer