Skip to content

Instantly share code, notes, and snippets.

View StewartLynch's full-sized avatar

Stewart Lynch StewartLynch

View GitHub Profile
@StewartLynch
StewartLynch / AppSceneDelegate.txt
Created February 27, 2026 23:20
AppDelegate and SceneDelegate for SQLiteData Record Sharing - Gift Register app.
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(
_ application: UIApplication,
configurationForConnecting connectingSceneSession: UISceneSession,
options: UIScene.ConnectionOptions
) -> UISceneConfiguration {
let configuration = UISceneConfiguration(
name: "Default Configuration",
sessionRole: connectingSceneSession.role
)
@StewartLynch
StewartLynch / OccasionsList.swift
Last active February 23, 2026 21:22
OccasionsList view for Gift Registry app
//
//----------------------------------------------
// Original project: GiftRegistry
//
// Follow me on Mastodon: https://iosdev.space/@StewartLynch
// Follow me on Threads: https://www.threads.net/@stewartlynch
// Follow me on Bluesky: https://bsky.app/profile/stewartlynch.bsky.social
// Follow me on X: https://x.com/StewartLynch
// Follow me on LinkedIn: https://linkedin.com/in/StewartLynch
// Email: slynch@createchsol.com
@StewartLynch
StewartLynch / Occasion_OccasionGift.txt
Last active February 21, 2026 05:15
Seed data for Occasions and Join Table for Gift Registry App
// Occasions
Occasion(id: UUID(0), name: "Christmas", hexColor: "C0392B")
Occasion(id: UUID(1), name: "Birthday", hexColor: "8E44AD")
Occasion(id: UUID(2), name: "Valentines Day", hexColor: "E91E8C")
Occasion(id: UUID(3), name: "Wedding", hexColor: "D4AF37")
// OccasionGifts (Many-to-Many join records)
OccasionGift(id: UUID(0), occasionID: UUID(0), giftID: UUID(0))
OccasionGift(id: UUID(1), occasionID: UUID(0), giftID: UUID(1))
OccasionGift(id: UUID(2), occasionID: UUID(1), giftID: UUID(1))
@StewartLynch
StewartLynch / UIColor+Extension.swift
Created February 21, 2026 05:11
UIColor Extension for GiftRegistry App.
//
//----------------------------------------------
// Original project: GiftRegistry
//
// Follow me on Mastodon: https://iosdev.space/@StewartLynch
// Follow me on Threads: https://www.threads.net/@stewartlynch
// Follow me on Bluesky: https://bsky.app/profile/stewartlynch.bsky.social
// Follow me on X: https://x.com/StewartLynch
// Follow me on LinkedIn: https://linkedin.com/in/StewartLynch
// Email: slynch@createchsol.com
@StewartLynch
StewartLynch / Color+Extension.swift
Created February 21, 2026 05:09
Color Extension for GiftRegistry App
//
//----------------------------------------------
// Original project: GiftRegistry
//
// Follow me on Mastodon: https://iosdev.space/@StewartLynch
// Follow me on Threads: https://www.threads.net/@stewartlynch
// Follow me on Bluesky: https://bsky.app/profile/stewartlynch.bsky.social
// Follow me on X: https://x.com/StewartLynch
// Follow me on LinkedIn: https://linkedin.com/in/StewartLynch
// Email: slynch@createchsol.com
@StewartLynch
StewartLynch / resizeOptimize.swift
Created February 16, 2026 20:05
Resize and Optimize Image
func resizedAndOptimizedImageData(from data: Data, maxWidth: CGFloat = 1000) -> Data? {
guard let image = UIImage(data: data) else { return nil }
let originalSize = image.size
let scaleFactor = min(1, maxWidth / originalSize.width)
let newSize = CGSize(
width: originalSize.width * scaleFactor,
height: originalSize.height * scaleFactor
)
@StewartLynch
StewartLynch / GiftForm.swift
Last active February 14, 2026 20:08
Gift Form View for Gift Registry SQLiteData series
import SwiftUI
struct GiftForm: View {
@State private var name = ""
@State private var price: Double?
@State private var isPurchased = false
@Environment(\.dismiss) var dismiss
var body: some View {
NavigationStack {
@StewartLynch
StewartLynch / GiftListSection.txt
Created February 12, 2026 22:19
Gift List Section for Gift Registry
Section {
List {
ForEach(model.gifts) { gift in
HStack {
Button {
// purchaseButtonTapped
} label: {
Image(systemName: gift.isPurchased ? "checkmark.circle.fill" : "circle")
.foregroundStyle(gift.isPurchased ? .green : .secondary)
@StewartLynch
StewartLynch / GiftSeed.txt
Last active February 12, 2026 21:22
Seed Items for Gifts Registry Gifts
// Gifts for Mom (3 gifts)
Gift(id: UUID(0), name: "Gardening Tool Set", price: 49.99, personID: UUID(0))
Gift(id: UUID(1), name: "Cookbook Collection", price: 35.00, isPurchased: true, personID: UUID(0))
Gift(id: UUID(2), name: "Herb Garden Kit", price: 24.99, personID: UUID(0))
// Gifts for Dad (2 gifts)
Gift(id: UUID(3), name: "Golf Club Set", price: 299.99, personID: UUID(1))
Gift(id: UUID(4), name: "Mystery Novel Bundle", price: 45.00, isPurchased: true, personID: UUID(1))
// Gifts for Sarah (4 gifts)
@StewartLynch
StewartLynch / FinanceTrackerPrompt.md
Created February 10, 2026 16:40
Personal Finance Tracker Prompt

Create a SwiftUI Personal Finance Tracker app using SwiftData with the following features:

  1. Data Models:

    • Category: name, color, monthly budget amount, icon (SF Symbol name)
    • Transaction: amount, date, note, relationship to Category
    • Use SwiftData for persistence with proper relationships
  2. Main Dashboard:

    • List of categories showing: name, icon, color
  • For each category: amount spent this month vs budget