Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version
  1. Create a new SwiftUI file called ProfileView.

  2. In the ProfileView file, create a basic view with the necessary elements for the user profile. For example, you may want to include an image view for the user's profile picture and a text view for their name and bio.

  3. In the NavigationView of the main view, add a NavigationLink to the profile icon image with the destination parameter set to the ProfileView:

NavigationView {
    VStack {
        // content of main view

        NavigationLink(destination: ProfileView()) {
            Image(systemName: "person.circle")
                .font(.largeTitle)
                .foregroundColor(.primary)
        }
    }
}
  1. Run the app and test that clicking on the profile icon leads to the ProfileView.