Skip to content

Instantly share code, notes, and snippets.

View auramagi's full-sized avatar

Mike Apurin auramagi

View GitHub Profile
@swiftui-lab
swiftui-lab / showSizes.swift
Last active April 2, 2024 22:37
A debugging modifier for SwiftUI views (showSizes)
// Author: SwiftUI-Lab (swiftui-lab.com)
// Description: Implementation of the showSizes() debugging modifier
// blog article: https://swiftui-lab.com/layout-protocol-part-2
import SwiftUI
struct MeasureExample: View {
var body: some View {
VStack {
@IsaacXen
IsaacXen / README.md
Last active May 2, 2024 09:57
(Almost) Every WWDC videos download links for aria2c.
@shaps80
shaps80 / CGPoint+Target.swift
Last active March 21, 2024 18:44
Distance travelled after decelerating to zero velocity at a constant rate. The included Playground file shows how you can use it with a pan gesture as an example.
public extension CGPoint {
// The target points after decelerating to 0 velocity at a constant rate
func target(initialVelocity: CGPoint, decelerationRate: CGFloat = UIScrollView.DecelerationRate.normal.rawValue) -> CGPoint {
let x = self.x + self.x.target(initialVelocity: initialVelocity.x, decelerationRate: decelerationRate)
let y = self.y + self.y.target(initialVelocity: initialVelocity.y, decelerationRate: decelerationRate)
return CGPoint(x: x, y: y)
}
}