What is the use of Link in SwiftUi?

 - : Swift UI :-

Link in SwiftUI :-

Open the link which you want to open in browser ex: www.google.com


Code Example :

        Link(“Go to google”, destination: URL(string:“www.google.com”))

  Link("Go to Google", destination: URL(string: "https://www.google.com")!)
                .buttonStyle(.borderedProminent)
                .buttonBorderShape(.capsule)
                .controlSize(.large)
                .tint(.green.opacity(1.5))
            
          Link("Go to Apple", destination: URL(string: "https://apple.com")!)
                .buttonStyle(.plain)
                .buttonBorderShape(.capsule)
                .padding()
                .border(.primary, width: 2)
                .controlSize(.mini)
                .tint(.black)


// custom link view


          Link(destination: URL(string: "https://apple.com")!) {

                HStack(spacing: 16) {

                    Image(systemName: "apple.logo")

                    Text("Apple Store")

                }

                .font(.largeTitle)

                    .foregroundColor(.white)

                    .padding()

                    .padding(.horizontal)

                    .background(

                        Capsule().fill(Color.blue)

                    )

            }





Comments

Popular posts from this blog

POWER BI

Face Recognition

BOOTSTRAP