import SwiftUI

//
// An example of a loading screen that requires user fingerprint.
//
struct FingerprintView: View {
    @State private var touch: Bool = false

    // Define common animation
    private var ease = Animation.easeInOut(duration: 0.5)
    
    var body: some View {
        VStack {
            ZStack {
                ZStack {
                    // "touch" is an SVG image with rendering specified as "Template Image" allowing us
                    // to specify its color via .foregroundColor modifier.
                    Image("touch")
                        .resizable()
                        .aspectRatio(contentMode: .fit)
                        .foregroundColor(Color(UIColor.systemGray))
                }
                
                GeometryReader { geo in
                    ZStack {
                        Image("touch")
                            .resizable()
                            .aspectRatio(contentMode: .fit)
                            .foregroundColor(Color(UIColor.white))
                            .clipShape(
                                // Use geo.size.width sinze Image is set to be in .fit aspectRatio thus
                                // giving us height of the image area - image is square.
                                Circle().offset(y: touch ? 0 : geo.size.width)
                            )
                            .animation(ease)
                        
                        Circle().fill(LinearGradient(gradient: Gradient(colors: [Color(UIColor.systemGreen), Color(UIColor.systemBlue)]), startPoint: .top, endPoint: .bottom))
                            .blendMode(.darken)
                            .clipShape(
                                Circle().offset(y: touch ? 0 : geo.size.width)
                            ).animation(ease)
                        
                        Circle().fill(LinearGradient(gradient: Gradient(colors: [Color(UIColor.systemGreen), Color(UIColor.systemBlue)]), startPoint: .top, endPoint: .bottom))
                            .opacity(0.2)
                            .clipShape(
                                Circle().offset(y: touch ? 0 : geo.size.width)
                            ).animation(ease)
                    }
                }
            }.padding(150)
            .onTapGesture{
                self.touch.toggle()
            }
        }
    }
}

Touch ID Animation

by Kane
This component shows how to implement animated Touch ID verification progress in SwiftUI.

Using SVG images and Clip masks we can colorize individual fingerprint lines with color gradient.