Skip to content

Instantly share code, notes, and snippets.

@heckj
heckj / Shell.swift
Created November 27, 2024 07:22 — forked from finestructure/Shell.swift
Tim's Process helpers
// Via Tim Condon
@discardableResult
func shell(_ args: String..., returnStdOut: Bool = false, stdIn: Pipe? = nil) throws -> (Int32, Pipe) {
return try shell(args, returnStdOut: returnStdOut, stdIn: stdIn)
}
@discardableResult
func shell(_ args: [String], returnStdOut: Bool = false, stdIn: Pipe? = nil) throws -> (Int32, Pipe) {
let task = Process()
@heckj
heckj / gist:c49b264823be8f1013c258ae991bb4a2
Created November 20, 2024 23:45
Apple VisionOS Q&A from Nov 20th session
VisionOS notes
Q: Curious what tools or workflows designers are using to mock up things like volumes or immersive spaces considering things like Sketch and Figma are 2D or "window" based?
A: Great question! We find a lot of people start with our visionOS Apple Design Resources especially on Figma (https://www.figma.com/community/file/1253443272911187215) and animate flat views to sell the ideas to partners. Then we've seen folks move to tools like Spline (https://spline.design), Blender, etc. for 3D workflows. In particular, Spline has a visionOS mirror app (https://docs.spline.design/doc/spline-mirror-for-visionos/docaQJC8SwTF) that makes it much more efficient to prototype 3d environments!
Q: I'm generating mesh data in code and then programmatically creating objects in a volume. As the app progresses, I need to switch out some of those meshes. If this is happening fairly rapidly (multiple times per second), would it generally be better to keep a reference to the entity to be able to update it, or sho
@heckj
heckj / benchmark-comparison.md
Created October 10, 2024 20:17
FirebladeECS value types benchmarking

Benchmarking switching FirebladeECS to use value types

Comparing results between branch master and the first commit from fireblade-engine/ecs#47 (2b51eeea6e379d4c66e04dc9103b199886993694)

Host 'MacBookPro' with 8 'arm64' processors with 16 GB memory, running:
Darwin Kernel Version 24.0.0: Tue Sep 24 23:36:26 PDT 2024; root:xnu-11215.1.12~1/RELEASE_ARM64_T8103

ECSBenchmark

Swift Project

cd ~/src/swift-project/swift
./utils/update-checkout --clone-with-ssh --clean

Base build

sccache --start-server
Translated Report (Full Report Below)
-------------------------------------
Process: Safari [2490]
Path: /Volumes/VOLUME/*/Safari.app/Contents/MacOS/Safari
Identifier: com.apple.Safari
Version: 16.5 (18615.2.9.11.4)
Build Info: Safari-7615002009011004~2
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
Building with settings:
USD source directory /Users/heckj/src/USD
USD install directory /opt/local/USD
3rd-party source directory /opt/local/USD/src
3rd-party install directory /opt/local/USD
Build directory /opt/local/USD/build
CMake generator Default
CMake toolset Default
Downloader curl
@heckj
heckj / FormAndVStackExample.swift
Created July 12, 2022 20:57
SwiftUI contextual rendering example
// Content expanded from Form reference documentation at
// https://developer.apple.com/documentation/swiftui/form
import SwiftUI
enum ProfileImageSize {
case large
case medium
case small
}
<unknown>:0: error: fatal error encountered while reading from module 'OrderedCollections'; please file a bug report with your project and the crash log
<unknown>:0: note: module 'OrderedCollections' full misc version is '5.3.2(5.3.2)/Apple Swift version 5.3.2 (swiftlang-1200.0.45 clang-1200.0.32.28)'
*** DESERIALIZATION FAILURE (please include this section in any bug report) ***
result not found
Cross-reference to module 'OrderedCollections'
... OrderedSet
... in an extension in module 'OrderedCollections'
... Element
#! /usr/bin/swift
//
// - This is just some AppKit boilerplate to launch a window.
//
import AppKit
@available(OSX 10.15, *)
class AppDelegate: NSObject, NSApplicationDelegate {
let window = NSWindow()
let windowDelegate = WindowDelegate()