SwiftUI Embed and Link

Rabialco Argana
2 min readAug 2, 2022
Source Image from Unsplash

— Embed —

What is Embed?

Based on the Cambridge dictionary, in normal terms embed means to fix something firmly into a substance. In business terms, embed means to include text, sound, images, video, etc. in a computer file, email message, or on a website.

How to implement embed in SwiftUI?

First thing first, you must create a SwiftUI-based project. After finishing creating the project, in the second step, you must create an “Embed View” file that can be reused when you want to embed. Here’s the example code snippet to create the Embed View.

After creating the Embed View, you can use it inside the Content View to show on your designated page. Here’s the code snippet to use the Embed View inside the Content View.

Result

— Link —

What is Link?

Based on the Cambridge dictionary, in normal terms link means a connection between two people, things, or ideas. Another meaning, link means a connection between documents on the internet.

How to implement link in SwiftUI?

Link is a control for navigating to a URL that is already being provided by apple natively. To create a link you must provide a destination URL and a title. The title tells the user the purpose of the link and can be a string, a title key that produces a localized string, or a view that acts as a label.

Now it’s time to try link URL in your project.

Like step above first thing first, you must create a SwiftUI-based project. After finishing creating the project, you can call the link struct that is already provided inside your Content View. Here’s the example code snippet to create the Embed View.

Result

--

--