From the course: iOS Development Tips

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Embed images in SwiftUI text

Embed images in SwiftUI text

From the course: iOS Development Tips

Embed images in SwiftUI text

- [Narrator] There's more going on in SwiftUI than the basic way most of us have learned it. For example, you can concatenate and embed images in SwiftUI text objects. In the exercise file I have here, I have an image view in a vstack. I've done something you might not have thought of. I've assigned text views to constants. Not only can you assign text views, but you can concatenate them. For example, above the image here, I'm just going to put in, hello + pizza and you can see it up in cams. Hello pizza. I'm going to do the same thing underneath and let's do an actual text object here of I space and then I'm going to put love + pizza. You can see it says, "I love pizza" on the bottom. If you need to format parts of a phrase, this can come in handy. For example, I can add here to love.italic and it italicizes. Or I can send it to one of these assigned values and I can modify one of these as well. And so I can…

Contents