Skip to content

Instantly share code, notes, and snippets.

View jaekong's full-sized avatar

Jaewon Choi jaekong

View GitHub Profile
@jaekong
jaekong / cli.swift
Last active September 19, 2024 12:18
cli.swift - A collection of small snippets for easy Swift command-line scripting
#!/usr/bin/env swift
import Foundation
@discardableResult
func run(_ command: String, shell: String = "zsh", passthrough: Bool = false, stdInContent: String? = nil) throws -> String {
let process = Process()
let stdOut = Pipe()
let stdErr = Pipe()
@jaekong
jaekong / iPhoneSensorDimensions.swift
Created October 23, 2024 05:32
iPhone supported by iOS 18 and their respective Face ID sensor array - notches, or dynamic islands - dimensions (in pts)
import Foundation
import RegexBuilder
/// iPhone supported by iOS 18 and their respective Face ID sensor array dimensions (in pts)
/// (Notches or Dynamic Islands)
enum iOSDevice: Comparable {
case iPhoneSE(generation: Int) // 2nd, 3rd
case iPhoneXR
case iPhoneXS(size: iOSDeviceSize, globalModel: Bool) // normal, max
case iPhone11(moniker: iOSDeviceMoniker?, size: iOSDeviceSize) // normal, pro, promax