Skip to content

Instantly share code, notes, and snippets.

View hunter-ji's full-sized avatar
🥤
coding...

Hunter Ji hunter-ji

🥤
coding...
View GitHub Profile
@stephancasas
stephancasas / AdvancedToolbarWindow.swift
Last active September 22, 2024 12:55
A SwiftUI-compatible window for macOS with advanced toolbar configurability.
//
// AdvancedToolbarWindow.swift
//
// Created by Stephan Casas on 3/17/23.
//
import SwiftUI;
import AppKit;
class AdvancedToolbarWindow<MainContent: View, ToolbarContent: View, TitleToolbarContent: View>: NSWindow, NSToolbarDelegate {
@joelekstrom
joelekstrom / SwiftUIDoubleClickModifier.swift
Last active August 28, 2024 09:58
A view modifier that can reliably detect double clicks on macOS, even in List
extension View {
/// Adds a double click handler this view (macOS only)
///
/// Example
/// ```
/// Text("Hello")
/// .onDoubleClick { print("Double click detected") }
/// ```
/// - Parameters:
/// - handler: Block invoked when a double click is detected