summaryrefslogtreecommitdiffstats
path: root/Solverv
diff options
context:
space:
mode:
authorivar <i@oiee.no>2025-12-15 23:42:01 +0100
committerivar <i@oiee.no>2025-12-15 23:42:01 +0100
commit0e1635b057903434c0f193ad9ead7035150b0773 (patch)
tree5838be9d71966099aa2b13d96c5b3a5215a534b0 /Solverv
downloadsolverv-0e1635b057903434c0f193ad9ead7035150b0773.tar.xz
solverv-0e1635b057903434c0f193ad9ead7035150b0773.zip
Initial Commit
Diffstat (limited to 'Solverv')
-rw-r--r--Solverv/Assets.xcassets/AccentColor.colorset/Contents.json11
-rw-r--r--Solverv/Assets.xcassets/AppIcon.appiconset/Contents.json35
-rw-r--r--Solverv/Assets.xcassets/Contents.json6
-rw-r--r--Solverv/ContentView.swift61
-rw-r--r--Solverv/Item.swift18
-rw-r--r--Solverv/SolvervApp.swift32
6 files changed, 163 insertions, 0 deletions
diff --git a/Solverv/Assets.xcassets/AccentColor.colorset/Contents.json b/Solverv/Assets.xcassets/AccentColor.colorset/Contents.json
new file mode 100644
index 0000000..eb87897
--- /dev/null
+++ b/Solverv/Assets.xcassets/AccentColor.colorset/Contents.json
@@ -0,0 +1,11 @@
+{
+ "colors" : [
+ {
+ "idiom" : "universal"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/Solverv/Assets.xcassets/AppIcon.appiconset/Contents.json b/Solverv/Assets.xcassets/AppIcon.appiconset/Contents.json
new file mode 100644
index 0000000..2305880
--- /dev/null
+++ b/Solverv/Assets.xcassets/AppIcon.appiconset/Contents.json
@@ -0,0 +1,35 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "platform" : "ios",
+ "size" : "1024x1024"
+ },
+ {
+ "appearances" : [
+ {
+ "appearance" : "luminosity",
+ "value" : "dark"
+ }
+ ],
+ "idiom" : "universal",
+ "platform" : "ios",
+ "size" : "1024x1024"
+ },
+ {
+ "appearances" : [
+ {
+ "appearance" : "luminosity",
+ "value" : "tinted"
+ }
+ ],
+ "idiom" : "universal",
+ "platform" : "ios",
+ "size" : "1024x1024"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/Solverv/Assets.xcassets/Contents.json b/Solverv/Assets.xcassets/Contents.json
new file mode 100644
index 0000000..73c0059
--- /dev/null
+++ b/Solverv/Assets.xcassets/Contents.json
@@ -0,0 +1,6 @@
+{
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/Solverv/ContentView.swift b/Solverv/ContentView.swift
new file mode 100644
index 0000000..b82e2c7
--- /dev/null
+++ b/Solverv/ContentView.swift
@@ -0,0 +1,61 @@
+//
+// ContentView.swift
+// Solverv
+//
+// Created by Ivar Løvlie on 15/12/2025.
+//
+
+import SwiftUI
+import SwiftData
+
+struct ContentView: View {
+ @Environment(\.modelContext) private var modelContext
+ @Query private var items: [Item]
+
+ var body: some View {
+ NavigationSplitView {
+ List {
+ ForEach(items) { item in
+ NavigationLink {
+ Text("Item at \(item.timestamp, format: Date.FormatStyle(date: .numeric, time: .standard))")
+ } label: {
+ Text(item.timestamp, format: Date.FormatStyle(date: .numeric, time: .standard))
+ }
+ }
+ .onDelete(perform: deleteItems)
+ }
+ .toolbar {
+ ToolbarItem(placement: .navigationBarTrailing) {
+ EditButton()
+ }
+ ToolbarItem {
+ Button(action: addItem) {
+ Label("Add Item", systemImage: "plus")
+ }
+ }
+ }
+ } detail: {
+ Text("Select an item")
+ }
+ }
+
+ private func addItem() {
+ withAnimation {
+ let newItem = Item(timestamp: Date())
+ modelContext.insert(newItem)
+ }
+ }
+
+ private func deleteItems(offsets: IndexSet) {
+ withAnimation {
+ for index in offsets {
+ modelContext.delete(items[index])
+ }
+ }
+ }
+}
+
+#Preview {
+ ContentView()
+ .modelContainer(for: Item.self, inMemory: true)
+}
diff --git a/Solverv/Item.swift b/Solverv/Item.swift
new file mode 100644
index 0000000..d15a7c0
--- /dev/null
+++ b/Solverv/Item.swift
@@ -0,0 +1,18 @@
+//
+// Item.swift
+// Solverv
+//
+// Created by Ivar Løvlie on 15/12/2025.
+//
+
+import Foundation
+import SwiftData
+
+@Model
+final class Item {
+ var timestamp: Date
+
+ init(timestamp: Date) {
+ self.timestamp = timestamp
+ }
+}
diff --git a/Solverv/SolvervApp.swift b/Solverv/SolvervApp.swift
new file mode 100644
index 0000000..0833363
--- /dev/null
+++ b/Solverv/SolvervApp.swift
@@ -0,0 +1,32 @@
+//
+// SolvervApp.swift
+// Solverv
+//
+// Created by Ivar Løvlie on 15/12/2025.
+//
+
+import SwiftUI
+import SwiftData
+
+@main
+struct SolvervApp: App {
+ var sharedModelContainer: ModelContainer = {
+ let schema = Schema([
+ Item.self,
+ ])
+ let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false)
+
+ do {
+ return try ModelContainer(for: schema, configurations: [modelConfiguration])
+ } catch {
+ fatalError("Could not create ModelContainer: \(error)")
+ }
+ }()
+
+ var body: some Scene {
+ WindowGroup {
+ ContentView()
+ }
+ .modelContainer(sharedModelContainer)
+ }
+}