UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

Creating a Reusable View

Forums > SwiftUI

Hi everyone! First time posting here. Extremely new to swift and swiftUI but i figured this would be the best place to ask for help. Im working with some friends and they asked me to do this, so here i am. I have this code below. I need each one of these "categories" to navigate to the "CategoriesView.swift" and have that view change, depending on what option they selected.

                NavigationLink(
                    destination: Text("DEVELOPMENT.PLACEHOLDER"),
                    label: {
                        Text("Redacted")
                    }
                ).buttonStyle(CategoryButtonStyle(image: Image(systemName: "app.fill")))
                Group{ 
                    NavigationLink(
                        destination: Text("DEVELOPMENT.PLACEHOLDER"),
                        label: {
                            Text("Redacted")
                        }
                    ).buttonStyle(CategoryButtonStyle(image: Image(systemName: "apps.iphone")))
                    NavigationLink(
                        destination: Text("DEVELOPMENT.PLACEHOLDER"),
                        label: {
                            Text("Redacted")
                        }).buttonStyle(CategoryButtonStyle(image: Image(systemName: "leaf.fill")))
                }
                NavigationLink(
                    destination: Text("DEVELOPMENT.PLACEHOLDER"),
                    label: {
                        Text("Redacted")
                    }
                ).buttonStyle(CategoryButtonStyle(image: Image(systemName: "lock.fill")))
                NavigationLink(
                    destination: Text("DEVELOPMENT.PLACEHOLDER"),
                    label: {
                        Text("Redacted")
                    }
                ).buttonStyle(CategoryButtonStyle(image: Image(systemName: "switch.2")))
                NavigationLink(
                    destination: Text("DEVELOPMENT.PLACEHOLDER"),
                    label: {
                        Text("Redacted")
                    }
                ).buttonStyle(CategoryButtonStyle(image: Image(systemName: "music.note")))
                NavigationLink(
                    destination: Text("DEVELOPMENT.PLACEHOLDER"),
                    label: {
                        Text("Redacted")
                    }

If something isn't worded correctly or is just confusing please let me know! Any and all help is greatly welcomed :)

2      

Sorry I am not sure what you are trying to do. Is this a dummy code that you are show us. Need more information as you seem to just repeating the NavigationLink

NavigationLink(
  destination: Text("DEVELOPMENT.PLACEHOLDER"),
  label: {
      Text("Redacted")
}

2      

TAKE YOUR SKILLS TO THE NEXT LEVEL If you like Hacking with Swift, you'll love Hacking with Swift+ – it's my premium service where you can learn advanced Swift and SwiftUI, functional programming, algorithms, and more. Plus it comes with stacks of benefits, including monthly live streams, downloadable projects, a 20% discount on all books, and free gifts!

Find out more

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.