This file contains 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 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 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 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 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 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 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 { |
This file contains 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 | |
import TextureMap | |
extension Path { | |
public func maskImage(size: CGSize) -> TMImage! { | |
guard let context = CGContext(data: nil, | |
width: Int(size.width), | |
height: Int(size.height), |
This file contains 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 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
#if os(macOS) | |
import AppKit | |
#else | |
import UIKit | |
#endif | |
import SwiftUI | |
#if os(macOS) | |
typealias SomeImage = NSImage | |
#else |
NewerOlder