Skip to content

Instantly share code, notes, and snippets.

View xmhafiz's full-sized avatar
🏠
Working from home

Mohd Hafiz xmhafiz

🏠
Working from home
View GitHub Profile
@xmhafiz
xmhafiz / CustomIntensityVisualEffectView.swift
Created July 5, 2021 03:06 — forked from darrarski/CustomIntensityVisualEffectView.swift
UIVisualEffectView subclass that allows to customise effect intensity
import UIKit
final class CustomIntensityVisualEffectView: UIVisualEffectView {
/// Create visual effect view with given effect and its intensity
///
/// - Parameters:
/// - effect: visual effect, eg UIBlurEffect(style: .dark)
/// - intensity: custom intensity from 0.0 (no effect) to 1.0 (full effect) using linear scale
init(effect: UIVisualEffect, intensity: CGFloat) {
theEffect = effect