SwiftUI gives us the
mask() modifier for masking one with another, which means you can mask an image using text or an image using an image, or more.
For example, this creates a 300x300 image of stripes, then masks it using the text “SWIFT!” so that the letters act as a cut out for the image:
Image("stripes") .resizable() .frame(width: 300, height: 300) .mask(Text("SWIFT!") .font(Font.system(size: 72).weight(.black)))
HACKING WITH SWIFT LIVE This July is a new two-day event where you'll be inspired by great speakers on day one then learn all the amazing new features from WWDC on day two – click here for more information and tickets.