When starting work on a new Xcode project, if no CLAUDE.md exists in the project root, create one with:
- Project overview and purpose
- Key architecture decisions
| try db.seed { | |
| Person(id: UUID(0), name: "Mom", notes: "Likes gardening and cooking") | |
| Person(id: UUID(1), name: "Dad", birthDate: formatter.date(from: "1968-11-03"), notes: "Enjoys golf and reading") | |
| Person(id: UUID(2), name: "Sarah", notes: "Sister - loves art supplies") | |
| Person(id: UUID(3), name: "Grandma", birthDate: formatter.date(from: "1942-02-21"), notes: "Knitting and classic movies") | |
| Person(id: UUID(4), name: "Grandpa", notes: "Fishing trips on weekends") | |
| Person(id: UUID(5), name: "Uncle Joe", birthDate: formatter.date(from: "1975-07-08"), notes: "BBQ master") | |
| Person(id: UUID(6), name: "Aunt Lisa", notes: "Yoga and photography") | |
| Person(id: UUID(7), name: "Cousin Mike", birthDate: formatter.date(from: "2001-09-14"), notes: "Video games and sneakers") | |
| Person(id: UUID(8), name: "Emma", birthDate: formatter.date(from: "1992-03-30"), notes: "Co-worker - coffee enthusiast") |
| import Foundation | |
| extension Date { | |
| /// Returns a date that is `offset` days from this date. | |
| /// - Parameter offset: The number of days to add or subtract from `self`. | |
| /// - Returns: A new `Date` `offset` days days before or after `self`. | |
| func offset(_ offset: Int) -> Date { | |
| Calendar.current.date(byAdding: .day, value: offset, to: self)! | |
| } | |
| } |
| import SwiftUI | |
| extension Binding { | |
| /// Binding to an optional value by providing a defatult value. | |
| /// | |
| /// example | |
| /// | |
| /// struct Sample: View { | |
| /// @Binding var name: String? | |
| /// |
| import SwiftUI | |
| struct <#ViewName#>: View, OverTopable { | |
| let title: String | |
| let choices: [<#Type#>] | |
| let current: <#Type#> | |
| @State var updatedContent: <#Type#> | |
| let hasTwoButtons: Bool | |
| @Binding var showOverTop: Bool | |
| var update: (<#Type#>) -> () |
| import SwiftUI | |
| extension HelpType { | |
| var pages: [HelpPage] { | |
| switch self { | |
| case .peopleList: | |
| [ | |
| HelpPage( | |
| image: Image(systemName: "person.3.fill"), | |
| title: "Person List", |
| import SwiftData | |
| import SwiftUI | |
| struct MockData: PreviewModifier { | |
| func body(content: Content, context: ModelContainer) -> some View { | |
| content | |
| .modelContainer(context) | |
| } | |
| static func makeSharedContext() async throws -> ModelContainer { | |
| let container = try! ModelContainer( |
| import WidgetKit | |
| import SwiftUI | |
| // MARK: - Entry Data Model | |
| struct <#WidgetName#>: TimelineEntry { | |
| let date: Date | |
| // Add any additional data you need for your widget | |
| } |
| { | |
| "genres": [ | |
| { | |
| "name" : "Fantasy", | |
| "color" : "#B33234" | |
| }, | |
| { | |
| "name" : "Science Fiction", | |
| "color" : "#FFC300" |