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 circleCenter(_ a: CGPoint, _ b: CGPoint, _ c: CGPoint) -> CGPoint { | |
| let dya = b.y - a.y | |
| let dxa = b.x - a.x | |
| let dyb = c.y - b.y | |
| let dxb = c.x - b.x | |
| let sa = dya / dxa | |
| let sb = dyb / dxb | |
| let x = (sa * sb * (a.y - c.y) + sb * (a.x + b.x) - sa * (b.x + c.x)) / (2 * (sb - sa)) | |
| let y = -1 * (x - (a.x + b.x) / 2) / sa + (a.y + b.y) / 2 | |
| return CGPoint(x: x, y: y) |
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 SwiftUI | |
| struct ContentView: View { | |
| @State private var isDragging: Bool = false | |
| @GestureState private var isDraggingActive: Bool = false | |
| var body: some View { | |
| ZStack { | |
| if isDragging { |
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 SwiftUI | |
| struct ContentView: View { | |
| @State private var contentMode: ContentMode = .fit | |
| var body: some View { | |
| ZStack { | |
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
| struct FrameLayout: Layout { | |
| let frame: CGRect | |
| func sizeThatFits(proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) -> CGSize { | |
| CGSize( | |
| width: proposal.width ?? 0.0, | |
| height: proposal.height ?? 0.0 | |
| ) | |
| } |
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
| /* | |
| // | |
| // xcode-dark-mode.css | |
| // Xcode Dark Mode | |
| // | |
| // Created by Hexagons on 2020-06-11. | |
| // http://hexagons.net/ | |
| // | |
| */ |
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 allocationViewModel<T: AnyObject>(_ viewModel: inout T?, as name: String) { | |
| weak var _viewModel: T? | |
| autoreleasepool { | |
| _viewModel = viewModel | |
| viewModel = nil | |
| } |
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 | |
| import CoreGraphics | |
| #if os(iOS) | |
| import UIKit | |
| #endif | |
| struct Animator { | |
| enum AnimationEase { | |
| case linear |
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
| extension XCTestCase { | |
| func isDeallocated<T: AnyObject>(_ object: inout T?) -> Bool { | |
| weak var _object: T? | |
| autoreleasepool { | |
| _object = object | |
| object = nil |
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
| // Created by Anton Heestand with the help of GPT-4 | |
| // AsyncGraphics: https://github.com/heestand-xyz/AsyncGraphics | |
| import SwiftUI | |
| import AsyncGraphics | |
| import Vision | |
| struct ContentView: View { | |
| @State var graphic: Graphic? |
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
| // | |
| // ContentView.swift | |
| // Spline Demo | |
| // | |
| // Created by Anton Heestand on 2022-08-27. | |
| // | |
| import SwiftUI | |
| struct ContentView: View { |
NewerOlder