Forked from darrarski/CustomIntensityVisualEffectView.swift
Created
December 12, 2019 09:54
-
-
Save Styrmist/db3f880bd6cced6c8c175084cc5924a1 to your computer and use it in GitHub Desktop.
Revisions
-
darrarski revised this gist
Nov 24, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,7 @@ class CustomIntensityVisualEffectView: UIVisualEffectView { } required init?(coder aDecoder: NSCoder) { fatalError() } // MARK: Private -
darrarski created this gist
Nov 24, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ import UIKit 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) { super.init(effect: nil) animator = UIViewPropertyAnimator(duration: 1, curve: .linear) { [unowned self] in self.effect = effect } animator.fractionComplete = intensity } required init?(coder aDecoder: NSCoder) { return nil } // MARK: Private private var animator: UIViewPropertyAnimator! }