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 | |
| final class Slider: UISlider { | |
| private let baseLayer = CALayer() // Step 3 | |
| private let trackLayer = CAGradientLayer() // Step 7 | |
| override func draw(_ rect: CGRect) { | |
| super.draw(rect) | |
| setup() |
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
| // | |
| // PomodoroPicker.swift | |
| // pomodoro | |
| // | |
| // Created by David Rozmajzl on 1/1/22. | |
| // | |
| import SwiftUI | |
| struct PomodoroPicker<Content, Item: Hashable>: View where Content: View { |
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
| func scrollViewDidScroll(_ scrollView: UIScrollView) { | |
| for (i, view) in scrollView.subviews.enumerated() { | |
| var ty = 0.0 | |
| if scrollView.contentOffset.y < 0 { | |
| // We're scrolling past the top of the scroll view. | |
| // Translate each item in the scroll view by some amount based on its index and scroll offset. | |
| ty = CGFloat(i) * abs(offsetY) / 8.0 * pow(1.12, CGFloat(i)) | |
| } | |
| view.transform = CGAffineTransform(translationX: 0, y: ty) | |
| } |
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
| // Author: SwiftUI-Lab (swiftui-lab.com) | |
| // Description: this learning tool is designed to showcase the different | |
| // Grid and GridRow view options, added in SwiftUI 2022. It is part of the | |
| // blog article: https://swiftui-lab.com/eager-grids | |
| // | |
| import SwiftUI | |
| import UniformTypeIdentifiers | |
| // The root view of the application | |
| struct ContentView: View { |
OlderNewer