• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

ReviewsLion

Reviews of online services and software

  • Hosting
  • WordPress Themes
  • SEO Tools
  • Domains
  • Other Topics
    • WordPress Plugins
    • Server Tools
    • Developer Tools
    • Online Businesses
    • VPN
    • Content Delivery Networks

How to Open Different Screens from First Screen in SwiftUI

Learning SwiftUI? Awesome! One of the first things you’ll want to know is how to show different screens from your first screen. Luckily, SwiftUI makes this super easy with just a few tools. Let’s dive in.

TL;DR: In SwiftUI, you can open different screens using things like NavigationLink, sheet, and fullScreenCover. These tools let you move between views either like a push or like a pop-up. You control these with Boolean values or direct links. Super clean, super fun!

Table of contents:
  • Why Different Screens?
    • 1. NavigationLink – Like a Push
      • Custom Button with NavigationLink
    • 2. Sheet – Like a Pop-Up
    • 3. FullScreenCover – Just Like It Sounds
    • How to Dismiss?
    • 4. Multiple Navigation Options
    • 5. Conditional Navigation – When You Need Rules
    • 6. What About Tabs?
    • Quick Tips & Tricks
    • More Fun with NavigationStack
    • Conclusion

Why Different Screens?

Your app won’t be just one screen. Imagine a settings screen, a profile screen, or a details page. All of these are different screens. So, we need ways to present them.

Let’s start with the easiest one.

1. NavigationLink – Like a Push

This is great for when you want to move forward in a flow, like tapping on a list item to see details.


struct FirstScreen: View {
    var body: some View {
        NavigationView {
            VStack {
                Text("Welcome!")
                NavigationLink("Go to Second Screen", destination: SecondScreen())
            }
        }
    }
}

struct SecondScreen: View {
    var body: some View {
        Text("Hello from the second screen!")
    }
}

Add NavigationView to wrap everything. Then NavigationLink handles the push!

Fun Tip: You can use titles, images, or custom buttons with it too.

Custom Button with NavigationLink


NavigationLink(destination: SecondScreen()) {
    HStack {
        Image(systemName: "star")
        Text("Shiny Screen")
    }
}

2. Sheet – Like a Pop-Up

Sometimes, you don’t want to push, you want a floating screen. That’s when you use .sheet.


struct FirstScreen: View {
    @State private var showSheet = false

    var body: some View {
        VStack {
            Text("First Screen")
            Button("Open Sheet") {
                showSheet = true
            }
        }
        .sheet(isPresented: $showSheet) {
            SheetScreen()
        }
    }
}

struct SheetScreen: View {
    var body: some View {
        Text("This is a sheet!")
    }
}

Click the button, and boom! Sheet slides up.

Pro Tip: Use sheets for temporary screens like settings or help.

3. FullScreenCover – Just Like It Sounds

Need something that covers the whole screen? Go big with .fullScreenCover.


struct FirstScreen: View {
    @State private var showFullScreen = false

    var body: some View {
        VStack {
            Text("Welcome!")
            Button("Cover Me!") {
                showFullScreen = true
            }
        }
        .fullScreenCover(isPresented: $showFullScreen) {
            FullScreenView()
        }
    }
}

struct FullScreenView: View {
    var body: some View {
        VStack {
            Text("This is full screen!")
            Button("Dismiss") {
                // There’s no direct dismiss button,
                // You usually use environment dismiss
            }
        }
    }
}

This makes it feel like a new app screen.

How to Dismiss?

When you use sheet or full screen views, users need a way to go back. SwiftUI gives us the @Environment tool.


@Environment(\.dismiss) var dismiss

Button("Close Me") {
    dismiss()
}

Put that in your second screen view. It’ll close the sheet or full view when tapped.

4. Multiple Navigation Options

What if you want to go to different screens from one screen? Let’s say you have three buttons. One goes to Profile, one to Settings, and one to Help.


struct FirstScreen: View {
    var body: some View {
        NavigationView {
            VStack(spacing: 20) {
                NavigationLink("Go to Profile", destination: ProfileScreen())
                NavigationLink("Go to Settings", destination: SettingsScreen())
                NavigationLink("Go to Help", destination: HelpScreen())
            }
        }
    }
}

Easy as stacking pancakes! 🥞

5. Conditional Navigation – When You Need Rules

Sometimes, you only want to show a screen if something happens, like if a user is logged in.

Use a @State variable with a controlled NavigationLink.


struct FirstScreen: View {
    @State private var goToSpecial = false

    var body: some View {
        NavigationView {
            VStack {
                Button("Unlock Surprise") {
                    goToSpecial = true
                }

                NavigationLink(
                    destination: SpecialScreen(),
                    isActive: $goToSpecial
                ) {
                    EmptyView()
                }
            }
        }
    }
}

This is called “programmatic navigation.” Useful for logins, payments, or anything fancy.

6. What About Tabs?

Want different screens but all part of a main layout? Use TabView.


TabView {
    FirstScreen()
        .tabItem {
            Label("Home", systemImage: "house")
        }

    ProfileScreen()
        .tabItem {
            Label("Profile", systemImage: "person")
        }

    SettingsScreen()
        .tabItem {
            Label("Settings", systemImage: "gear")
        }
}

Each tab is a whole new screen. Simple!

Quick Tips & Tricks

  • NavigationView only needed once, at the root level.
  • Use @State for controlling sheet visibility.
  • Use @Environment(\.dismiss) for going back.
  • Use NavigationLink for simple stacking screens.

More Fun with NavigationStack

In iOS 16 and later, use NavigationStack instead of NavigationView.


NavigationStack {
    NavigationLink("Next", destination: SecondScreen())
}

Stacks give you more power and control, especially for advanced navigation with paths.

Conclusion

Look at you! You now know how to open all kinds of screens from the first one.

  • Need to go forward in a flow? Use NavigationLink.
  • Need a pop-up? Use sheet.
  • Need full-screen? Use fullScreenCover.
  • Need tabs? Use TabView.

SwiftUI makes it fun to mix and match. Try things out and see what works best for your app.

Happy coding! 🚀

Filed Under: Blog

Related Posts:

  • black samsung android smartphone displaying blue screen user onboarding, first time experience, app walkthrough
    Onboarding That Converts: First-Run UX Essentials
  • System Content Management SEO Application Graphic Concept
    Win SERPs With First-Party Data: Methods and Examples
  • A close up of a yellow snake’s head python code object detection webcam video
    Beginner’s Tutorial: Writing Your First AI Code for…

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Recent posts

How to Open Different Screens from First Screen in SwiftUI

Efficient AI Architecture for Complex Reasoning: Beyond LLMs

The Future of Comprehensive Content SEO Pillars

Aira Charging Pad: Wireless Charging Breakthroughs

Breaking: Latest Digital Marketing News Updates July 2025 – Key Takeaways

Editorial Calendar vs Content Calendar: Which One is Right for You in 2026?

Mangools vs Semrush: Which One is Right for You in 2026?

Beginner’s Guide to Best Webcasting Solutions

Common Mistakes in SEO Canonicalisation and How to Avoid Them

What is energy efficient Ethernet option?

Footer

WebFactory’s WordPress Plugins

  • UnderConstructionPage
  • WP Reset
  • Google Maps Widget
  • Minimal Coming Soon & Maintenance Mode
  • WP 301 Redirects
  • WP Sticky

Articles you will like

  • 5,000+ Sites that Accept Guest Posts
  • WordPress Maintenance Services Roundup & Comparison
  • What Are the Best Selling WordPress Themes 2019?
  • The Ultimate Guide to WordPress Maintenance for Beginners
  • Ultimate Guide to Creating Redirects in WordPress

Join us

  • Facebook
  • Privacy Policy
  • Contact Us

Affiliate Disclosure: This page may have affiliate links. When you click the link and buy the product or service, I’ll receive a commission.

Copyright © 2026 · Reviewslion

  • Facebook
Like every other site, this one uses cookies too. Read the fine print to learn more. By continuing to browse, you agree to our use of cookies.X