Skip to content

Instantly share code, notes, and snippets.

@Matt54
Matt54 / ImmersiveLaserPenMeasurementView.swift
Created October 27, 2025 03:20
Logitech Muse Laser Pen Scene Measurement (RealityKit & ARKit)
import ARKit
import CoreHaptics
import GameController
import RealityKit
import SwiftUI
struct ImmersiveLaserPenMeasurementView: View {
@State private var stylusManager = StylusLaserPenManager()
var body: some View {
@Matt54
Matt54 / AppModel.swift
Created October 24, 2025 03:05
Logitech Muse for Apple Vision Pro Tracking, Action Buttons, and Haptics in RealityKit
import SwiftUI
@MainActor
@Observable
class AppModel {
let immersiveSpaceID = "ImmersiveSpace"
enum ImmersiveSpaceState {
case closed
case inTransition
case open
@tabatkins
tabatkins / proposal.md
Last active August 22, 2023 13:31
Pattern-matching across constructs

"Matchers Everywhere" Proposal

tldr:

  • Matchers are mostly identical to what's in the repo today, except:
    • I added "predicate matchers" (if(<boolean-expr>)) and removed the if(...) part from the match() syntax.
    • Added ident when <matcher> binding-matcher form, to match its usage in destructuring.
    • Made regex matchers use /foo/ when <matcher> for consistency (and removed the named bindings for simplicity).
    • Added a simpler custom-matcher syntax (foo(<matchers>))
@msteen
msteen / print-lezer-tree.ts
Last active February 23, 2025 18:51
Print Lezer Trees
// MIT License
//
// Copyright (c) 2021 Matthijs Steen
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@thecodewarrior
thecodewarrior / App Icon Template.svg
Last active December 9, 2025 17:38
An SVG template for creating macOS app icons, including guides and the standard drop shadow
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@avaidyam
avaidyam / BackdropView.swift
Created July 2, 2020 17:23
DIY NSVisualEffectView using Private API for macOS
// TODO: setting window transforms (or mission control) flattens layers...
// TODO: Mask image vs path (layer)?
/// `NSVisualEffectView`:
///
/// A view that adds translucency and vibrancy effects to the views in your interface.
/// When you want views to be more prominent in your interface, place them in a
/// backdrop view. The backdrop view is partially transparent, allowing some of
/// the underlying content to show through. Typically, you use a backdrop view
/// to blur background content, instead of obscuring it completely. It can also
@lattner
lattner / TaskConcurrencyManifesto.md
Last active December 10, 2025 18:44
Swift Concurrency Manifesto
@chriseidhof
chriseidhof / references.swift
Last active October 14, 2021 10:24
References Blogpost
//: Playground - noun: a place where people can play
import Foundation
final class Disposable {
private let dispose: () -> ()
init(_ dispose: @escaping () -> ()) {
self.dispose = dispose
}
@mchambers
mchambers / serializer.swift
Created June 25, 2014 07:49
A simple, limited model-to-JSON serializer in Swift.
// Here we'll use Swift's IDE-supporting reflect()
// function to build a basic JSON serializer.
// Per the fine engineers at WWDC, Swift's reflection support
// exists purely to support the IDE and the Playground. But
// we can have some fun with it anyway. ;)
class SerializerBase {
}
@mchambers
mchambers / reflect.swift
Last active March 5, 2021 09:20
Basic Reflection in Swift.
// Let's define a basic Swift class.
class Fruit {
var type=1
var name="Apple"
var delicious=true
}
// We can get at some info about an instance of an object using reflect(), which returns a Mirror.
reflect(Fruit()).count
reflect(Fruit())[1].0