This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Cocoa | |
import UniformTypeIdentifiers | |
extension UTTagClass { | |
static let deviceModelCode = UTTagClass(rawValue: "com.apple.device-model-code") | |
} | |
extension UTType { | |
static let macBook = UTType("com.apple.mac.laptop") | |
static let macBookWithNotch = UTType("com.apple.mac.notched-laptop") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:root { | |
--sand1: hsl(50, 20%, 99%); | |
--sand2: hsl(60, 7.7%, 97.5%); | |
--sand3: hsl(59, 6.5%, 95.1%); | |
--sand4: hsl(58, 6.1%, 92.9%); | |
--sand5: hsl(57, 6%, 90.7%); | |
--sand6: hsl(56, 5.9%, 88.4%); | |
--sand7: hsl(55, 5.9%, 85.2%); | |
--sand8: hsl(51, 6%, 77.1%); | |
--sand9: hsl(50, 2%, 55.7%); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This playground shows you a few different ways to get device info via IOKit. | |
// If you want to explore IOKit and look for interesting data I would download | |
// the Additional Developer Tools from Apple and use the IORegistryExplorer app. | |
// It makes it super easy to poke around in the IOKit planes. | |
import IOKit | |
import Foundation | |
// For convient access we can make a computed getter for the PlatformExpert. | |
// Traditionally this has been where you go to find all sorts of data about the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
struct ShellCommand { | |
@discardableResult | |
static func stream(_ command: String) -> Int32 { | |
let outputPipe = Pipe() | |
let task = self.createProcess([command], outputPipe) | |
outputPipe.fileHandleForReading.readabilityHandler = { fileHandle in self.streamOutput(outputPipe, fileHandle) } | |
do { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ContentView.Swift | |
// KeyboardAttachedView | |
// | |
// Created by Gavin Nelson on 8/19/24. | |
// | |
import SwiftUI | |
import UIKit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Some Swift code for different ways to find the current username on macOS. | |
// | |
// You can run this in a Playground, or compile it with `swiftc`. Compiling | |
// it will let you experiment with different ways of running the command. | |
print("********** Foundation Usernames **********") | |
// If you are only importing Foundation you have a few options to get the current user. | |
// Note that if run from the CLI they will report the CLI user running them. | |
import Foundation |
OlderNewer