Fully updated for Xcode 11 GM
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)))
LEARN SWIFTUI FOR FREE I have a massive, free SwiftUI video collection on YouTube teaching you how to build complete apps with SwiftUI – check it out!