Skip to content

Instantly share code, notes, and snippets.

View lzell's full-sized avatar

Lou Zell lzell

View GitHub Profile
@lzell
lzell / modern_wwd_crash_course_notes.txt
Created March 21, 2024 00:59
modern_wwd_crash_course_notes.txt
## WWDC notes
2019 Introducing SwiftUI
- Views are structs, value types, passed by value, allocated on the stack.
- If you have something like `let room: Room` as a property, and Room is a
struct, then the surrounding struct has "the size and weight of a room, no
additional allocation or reference counting overhead"
- 17:30
"make liberal use of small, single purpose views in SwiftUI"
"views in SwiftUI are incredibly lightweight"
@lzell
lzell / StabilityUltra.swift
Last active July 31, 2024 05:04
StabilityUltra.swift
import Foundation
import SwiftUI
import AIProxy
final actor ImageLoader {
static func create(fromPrompt prompt: String) async -> UIImage? {
let service = AIProxy.stabilityAIService(
partialKey: "your-partial-key",
serviceURL: "your-service-url")
do {
@lzell
lzell / catch_foundation.swift
Last active October 7, 2024 19:08
How to catch a Foundation timeout
import AIProxy
let openAIService = AIProxy.openAIService(
partialKey: "partial-key-from-your-developer-dashboard",
serviceURL: "service-url-from-your-developer-dashboard"
)
do {
let response = try await openAIService.chatCompletionRequest(body: .init(
model: "o1-mini",
@lzell
lzell / TrackingKeychain.swift
Created March 10, 2025 17:14
Swift helper to store data in keychain
//
// TrackingKeychain.swift
// AIProxy
//
// Created by Lou Zell on 1/30/25.
//
import Foundation
struct TrackingKeychain {
@lzell
lzell / question.md
Created April 10, 2025 18:03
Drop from URLSession to Network framework for SNI

Hi Dev Forums and Quinn "The Eskimo!",

Short version

Is there sample NWConnection code available that behaves in a similar way to the higher level URLSession and URLRequest APIs?

Long version

My understanding from morning googling is that there is no way to make a TLS handshake happy using URLSession + URLRequest with an IP instead of FQDN.