Autumn Sale50% offCOMPOT
Images & EffectsFree ComponentiOS 16.0+Xcode 15+

Image with Custom Mask

Image clipped with custom shape masks (stars, shields, rounded shapes).

SwiftUI Implementation

Pure Vanilla Swift • No Dependencies
imageWMask.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

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 Store