Skip to content

Instantly share code, notes, and snippets.

View hunter-ji's full-sized avatar
🥤
搬砖中...

Hunter Ji hunter-ji

🥤
搬砖中...
View GitHub Profile
@stephancasas
stephancasas / AdvancedToolbarWindow.swift
Last active June 4, 2024 05:34
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 March 11, 2024 12:02
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