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 characters
class ShimmerFragment: NSTextLayoutFragment { | |
/// Phase in -1...+1 indicating center of the narrow gradient band | |
var phase: CGFloat = 0.5 | |
var gradientRange: NSRange? | |
override func draw(at point: CGPoint, in context: CGContext) { | |
// Draw the entire text normally first | |
super.draw(at: point, in: context) | |
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 characters
import UIKit | |
/// | |
///Declaration | |
/// | |
protocol UIViewBuilder: AnyObject {} | |
extension UIViewBuilder where Self: UIView { | |
init(_ build: ((Self) -> Void)) { |
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 characters
import Foundation | |
func > (left: NSDate, right: NSDate) -> Bool { | |
return left.compare(right) == .OrderedDescending | |
} | |
extension NSCalendar { | |
func dateRange(startDate startDate: NSDate, endDate: NSDate, stepUnits: NSCalendarUnit, stepValue: Int) -> DateRange { | |
let dateRange = DateRange(calendar: self, startDate: startDate, endDate: endDate, stepUnits: stepUnits, stepValue: stepValue, multiplier: 0) | |
return dateRange |