Link – SwiftUI Reference Guide



Link – SwiftUI Reference Guide

Link – SwiftUI Reference Guide

♥️ SAVE 50% for a limited time.
https://www.udemy.com/course/swiftui-masterclass-course-ios-development-with-swift/?couponCode=SUNSHINE

Expires on April 28, 2023 2:13 AM PDT (GMT -7)

🟢 🟣 LIMITED TIME OFFER – SAVE 37%
Practical iOS and macOS app development tutorials with SwiftUI in 4K
https://credo.academy

The SwiftUI Link is a control for navigating to a URL. We can create a link by providing a destination URL and a title.

The title tells the user the purpose of the link. This can be a string, a button, or a custom view that acts as a label.

The following example creates a link to the apple.com website and it displays the title string as a link-styled view.

When a user taps or clicks a Link, the default behavior depends on the contents of the URL and its associated application.

Links were designed for the web, but we can add them to our applications and let the system decide where to open the linked document.

For example, a SwiftUI Link can trigger to call a phone number, open the default email client, or other apps that Apple provides schemes for.

Customization.

As with other views, we can style links using standard view modifiers depending on the view type of the link’s label.

For example, a text label could be modified with a font or foreground color modifier to customize the appearance.

Alternatively, we can add the same styling options that we also use on buttons.

Just like button style: bordered.

Then, button border shape: capsule.

Different control sizes or tint colors.

Custom Link View

Also, there is another initializer we can use to create a custom button-like view for the Link.

To use this new link initializer, we need to put the destination parameter first, and then we can create and customize any view that users can tap on to navigate to a URL.

In this example, we created a well noticeable stylized view with a system symbol and a text view wrapped into a horizontal view container.

CHAPTERS

00:00 SwiftUI Link
00:33 Link URL
00:51 Custom Link
01:19 Link View

This SwiftUI tutorial is part of the best online SwiftUI Masterclass course.

🟣 Practical iOS and macOS app development tutorials with SwiftUI in 4K
https://credo.academy

This 4K tutorial is part of the bestseller SwiftUI Masterclass course with more than 30 thousand students at the Credo Academy.

#SwiftUI #CredoAcademy #iOSDevelopment

Comments are closed.