Skip to content

Instantly share code, notes, and snippets.

View kcourtois's full-sized avatar
🎯
Focusing

Kévin Courtois kcourtois

🎯
Focusing
View GitHub Profile
import SwiftUI
import UIKit
extension Color {
var uiColor: UIColor {
if #available(iOS 14, *) {
// iOS 14 introduces an API to convert SwiftUI.Color to UIKit.UIColor
// but it does not produce a color which reacts to changes in color scheme
// (light mode/dark mode). To make that work we need to extract the color
@westerlund
westerlund / UISlider.swift
Created May 3, 2016 09:19
Snapping UISlider in Swift
final class SnappingSlider: UISlider {
override var value: Float {
set { super.value = newValue }
get {
return round(super.value * 1.0) / 1.0
}
}
}