Skip to content

Instantly share code, notes, and snippets.

View IsaacXen's full-sized avatar

ix4n33 IsaacXen

View GitHub Profile
@IsaacXen
IsaacXen / DispatchQueue+Once.swift
Last active December 5, 2022 19:14
dispatch_once in Swift, and more.
import Foundation
public extension DispatchQueue {
private struct _once_Domain: Hashable {
/// The unique identifier for the class instance as domain.
var identifier: ObjectIdentifier
/// A weak reference to the class instance as domain.
weak var lifetimeObject: NSObject?
import UIKit
public extension NSCollectionLayoutAnchor {
struct Offset {
fileprivate var absolute: CGPoint?
fileprivate var fractional: CGPoint?
private init(absolute: CGPoint?, fractional: CGPoint?) {
self.absolute = absolute
self.fractional = fractional
@IsaacXen
IsaacXen / README.md
Last active November 3, 2024 04:19
(Almost) Every WWDC videos download links for aria2c.
@IsaacXen
IsaacXen / TextField.swift
Last active March 16, 2023 12:36
NSTextField subclass with focus and blur callback.
import Cocoa
protocol TextFieldDelegate: class {
func textFieldDidBecomeFirstResponder(_ textField: TextField)
func textFieldDidResignFirstResponder(_ textField: TextField)
}
class TextField: NSTextField {
weak var firstResponderDelegate: TextFieldDelegate?