
Liquid Switch
A toggle whose knob stretches like a drop of liquid as it travels, squashes against the wall and wobbles back while the gradient fill pours in behind it. Tap or fling it with your finger; ships with aqua, lime, sunset and grape presets.
- toggle
- switch
- animation
snippet.swift258 lines
6 files • Scroll to see all →
/// Gradient presets for `LiquidSwitch`. Make your own with `LiquidSwitchTint([...])`.public struct LiquidSwitchTint { public let colors: [Color] public init(_ colors: [Color]) { self.colors = colors.isEmpty ? [.accentColor] : colors } public static let aqua = LiquidSwitchTint([Color(red: 0.0, green: 0.82, blue: 1.0), Color(red: 0.18, green: 0.42, blue: 1.0)]) public static let lime = LiquidSwitchTint([Color(red: 0.62, green: 0.94, blue: 0.3), Color(red: 0.08, green: 0.74, blue: 0.46)]) public static let sunset = LiquidSwitchTint([Color(red: 1.0, green: 0.7, blue: 0.22), Color(red: 1.0, green: 0.27, blue: 0.45)]) public static let grape = LiquidSwitchTint([Color(red: 0.82, green: 0.42, blue: 1.0), Color(red: 0.42, green: 0.26, blue: 0.98)])}Viewing: TintPresets.swift•1 of 6