Rectangle() .fill(Color.orange) .frame(width: 200, height: 200)
Rectangle() .fill(Color.orange) .frame(width: 200, height: 200) .overlay(Text("DevTechie").font(.largeTitle))
Rectangle() .fill(Color.orange) .frame(width: 200, height: 200) .overlay(Text("DevTechie").font(.largeTitle)) .mask { Image(systemName: "heart.fill") .resizable() .frame(width: 200, height: 200) }
struct MaskingExample: View { var body: some View { AsyncImage(url: URL(string: "https://images.unsplash.com/photo-1648650571468-501c7dad85f2?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1287&q=80")!, scale: 1.0) { image in image .resizable() .scaledToFit() } placeholder: { RoundedRectangle(cornerRadius: 10) }.mask { Text("DevTechie") .font(.custom("Avnair", size: 64)) } } }
With that we have reached the end of this article. Thank you once again for reading. Subscribe to our weekly newsletter at https://www.devtechie.com