Image with Custom Mask
Image clipped with custom shape masks (stars, shields, rounded shapes).
SwiftUI Implementation
Pure Vanilla Swift • No DependenciesimageWMask.swift
import SwiftUI
// I'm using free images from: https://unsplash.com/
// You can download the image here: https://drive.google.com/file/d/1xfhSIbV6OSMB9u_lM6l_hsPzzaAL9MME/view?usp=sharing
struct ImageWMask: View {
var body: some View {
Image("fiona")
.resizable()
.scaledToFit()
.mask {
Image(systemName: "seal.fill")
.resizable()
.scaledToFit()
}
.frame(width: 100)
.shadow(color: .gray.opacity(0.6), radius: 4)
}
}
#Preview {
ImageWMask()
}Ready to copy and paste directly into any Xcode project running iOS 16.0+.
Recommended Use Cases
- App settings, preferences, and account configuration screens
Component Details
- Category
- Images & Effects
- iOS Compatibility
- iOS 16.0+
- Xcode Version
- Xcode 15+
- Platform
- iOS
- License Tier
- Free
- Themes & Contexts
- settingsaccount
C
Compot for iOS
Native SwiftUI playground app
Preview all 130+ components interactively on your device and copy code straight to Xcode with 1 tap.
Get Compot on the App StoreRelated SwiftUI Components
More components in Images & Effects and related app architectures.
ButtonsiOS 16.0+
Button with Repeat Behavior
Stepper-like button with continuous press-and-hold repeating action for counters and volume adjustment.
View Component & Code
ButtonsiOS 16.0+
Button for Copying
Smart copy button that temporarily switches icon and text to "Copied!" with tactile haptic feedback.
View Component & Code
ButtonsiOS 16.0+
Bordered Green Rounded Button (Regular)
Standard-sized bordered button with custom green tint and continuous rounded corners.
View Component & Code