Skip to content

Instantly share code, notes, and snippets.

View chockenberry's full-sized avatar

Craig Hockenberry chockenberry

View GitHub Profile
//
// ColorSchemeApp.swift
// ColorScheme
//
// Created by Craig Hockenberry on 9/11/24.
//
import SwiftUI
@main
import UIKit
enum Name {
case foo(Foo)
case bar(Bar)
struct Foo {
let name: String
}
@chockenberry
chockenberry / ContentView.swift
Created July 2, 2024 19:29
NestedObservable
//
// ContentView.swift
// NestedObservables
//
// Created by Craig Hockenberry on 7/2/24.
//
import SwiftUI
@Observable
@chockenberry
chockenberry / ContentView.swift
Created April 18, 2024 21:21
Observable with backing store
//
// ContentView.swift
// ObservableTester
//
// Created by Craig Hockenberry on 4/18/24.
//
import SwiftUI
class BackingStore {
@chockenberry
chockenberry / ContentView.swift
Created April 17, 2024 17:43
NavigationPath Experiments
//
// ContentView.swift
// NavigationTest
//
// Created by Craig Hockenberry on 4/16/24.
//
import SwiftUI
struct OddView: View {
@chockenberry
chockenberry / ContentView.swift
Created April 12, 2024 17:58
Optional Bindable
//
// ContentView.swift
// BindableOptional
//
// Created by Craig Hockenberry on 4/12/24.
//
import SwiftUI
@Observable
@chockenberry
chockenberry / ContentView.swift
Created April 10, 2024 18:29
SwiftUI Protocol Bindings
//
// ContentView.swift
// ProtocolBinding
//
// Created by Craig Hockenberry on 4/10/24.
//
import SwiftUI
protocol ShapeProtocol {
@chockenberry
chockenberry / PrivacyInfo.xcprivacy
Last active April 19, 2024 18:39
PrivacyInfo.xcprivacy sample
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>CA92.1</string>
@chockenberry
chockenberry / df.sh
Created March 4, 2024 18:51
df Replacement
#!/bin/sh
if [ ! -z "$*" ]; then
echo "this is ~/bin/df, use /bin/df"
exit 1
fi
protect=`mount | grep -v "read-only" | grep "protect" | cut -f 3 -w`
nosuid=`mount | grep -v "read-only" | grep "nosuid" | cut -f 3 -w`
@chockenberry
chockenberry / url.swift
Created November 27, 2023 23:35
Get URL for a published NetService instance
extension NetService {
var url: URL? {
get {
if self.port != -1 {
var urlComponents = URLComponents()
urlComponents.scheme = "http"
if let hostName = self.hostName {
urlComponents.host = hostName.lowercased()
}