summaryrefslogtreecommitdiff
path: root/Tonbo
diff options
context:
space:
mode:
authorFuwn <[email protected]>2025-02-13 02:44:02 -0800
committerFuwn <[email protected]>2025-02-13 02:44:02 -0800
commit2e22626a5b994182a5c4990d042de1c3f73e47b3 (patch)
treec7bc556b04d9092197ff366c3d1b9624dbccf62f /Tonbo
downloadtonbo-main.tar.xz
tonbo-main.zip
feat: Initial commitHEADmain
Diffstat (limited to 'Tonbo')
-rw-r--r--Tonbo/Assets.xcassets/AccentColor.colorset/Contents.json11
-rw-r--r--Tonbo/Assets.xcassets/AppIcon.appiconset/Contents.json85
-rw-r--r--Tonbo/Assets.xcassets/Contents.json6
-rw-r--r--Tonbo/ContentView.swift59
-rw-r--r--Tonbo/Info.plist10
-rw-r--r--Tonbo/Item.swift11
-rw-r--r--Tonbo/Operations/Queries/UserIDQuery.graphql.swift44
-rw-r--r--Tonbo/Preview Content/Preview Assets.xcassets/Contents.json6
-rw-r--r--Tonbo/Schema/Objects/Query.graphql.swift12
-rw-r--r--Tonbo/Schema/Objects/User.graphql.swift13
-rw-r--r--Tonbo/Schema/SchemaConfiguration.swift15
-rw-r--r--Tonbo/Schema/SchemaMetadata.graphql.swift32
-rw-r--r--Tonbo/Tonbo.entitlements20
-rw-r--r--Tonbo/TonboApp.swift23
14 files changed, 347 insertions, 0 deletions
diff --git a/Tonbo/Assets.xcassets/AccentColor.colorset/Contents.json b/Tonbo/Assets.xcassets/AccentColor.colorset/Contents.json
new file mode 100644
index 0000000..eb87897
--- /dev/null
+++ b/Tonbo/Assets.xcassets/AccentColor.colorset/Contents.json
@@ -0,0 +1,11 @@
+{
+ "colors" : [
+ {
+ "idiom" : "universal"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/Tonbo/Assets.xcassets/AppIcon.appiconset/Contents.json b/Tonbo/Assets.xcassets/AppIcon.appiconset/Contents.json
new file mode 100644
index 0000000..ffdfe15
--- /dev/null
+++ b/Tonbo/Assets.xcassets/AppIcon.appiconset/Contents.json
@@ -0,0 +1,85 @@
+{
+ "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"
+ },
+ {
+ "idiom" : "mac",
+ "scale" : "1x",
+ "size" : "16x16"
+ },
+ {
+ "idiom" : "mac",
+ "scale" : "2x",
+ "size" : "16x16"
+ },
+ {
+ "idiom" : "mac",
+ "scale" : "1x",
+ "size" : "32x32"
+ },
+ {
+ "idiom" : "mac",
+ "scale" : "2x",
+ "size" : "32x32"
+ },
+ {
+ "idiom" : "mac",
+ "scale" : "1x",
+ "size" : "128x128"
+ },
+ {
+ "idiom" : "mac",
+ "scale" : "2x",
+ "size" : "128x128"
+ },
+ {
+ "idiom" : "mac",
+ "scale" : "1x",
+ "size" : "256x256"
+ },
+ {
+ "idiom" : "mac",
+ "scale" : "2x",
+ "size" : "256x256"
+ },
+ {
+ "idiom" : "mac",
+ "scale" : "1x",
+ "size" : "512x512"
+ },
+ {
+ "idiom" : "mac",
+ "scale" : "2x",
+ "size" : "512x512"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/Tonbo/Assets.xcassets/Contents.json b/Tonbo/Assets.xcassets/Contents.json
new file mode 100644
index 0000000..73c0059
--- /dev/null
+++ b/Tonbo/Assets.xcassets/Contents.json
@@ -0,0 +1,6 @@
+{
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/Tonbo/ContentView.swift b/Tonbo/ContentView.swift
new file mode 100644
index 0000000..b806ec4
--- /dev/null
+++ b/Tonbo/ContentView.swift
@@ -0,0 +1,59 @@
+import SwiftData
+import SwiftUI
+
+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)
+ }
+ #if os(macOS)
+ .navigationSplitViewColumnWidth(min: 180, ideal: 200)
+ #endif
+ .toolbar {
+ #if os(iOS)
+ ToolbarItem(placement: .navigationBarTrailing) {
+ EditButton()
+ }
+ #endif
+ 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/Tonbo/Info.plist b/Tonbo/Info.plist
new file mode 100644
index 0000000..ca9a074
--- /dev/null
+++ b/Tonbo/Info.plist
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>UIBackgroundModes</key>
+ <array>
+ <string>remote-notification</string>
+ </array>
+</dict>
+</plist>
diff --git a/Tonbo/Item.swift b/Tonbo/Item.swift
new file mode 100644
index 0000000..a2f85bf
--- /dev/null
+++ b/Tonbo/Item.swift
@@ -0,0 +1,11 @@
+import Foundation
+import SwiftData
+
+@Model
+final class Item {
+ var timestamp: Date
+
+ init(timestamp: Date) {
+ self.timestamp = timestamp
+ }
+}
diff --git a/Tonbo/Operations/Queries/UserIDQuery.graphql.swift b/Tonbo/Operations/Queries/UserIDQuery.graphql.swift
new file mode 100644
index 0000000..e5ebf5f
--- /dev/null
+++ b/Tonbo/Operations/Queries/UserIDQuery.graphql.swift
@@ -0,0 +1,44 @@
+// @generated
+// This file was automatically generated and should not be edited.
+
+@_exported import ApolloAPI
+
+public class UserIDQuery: GraphQLQuery {
+ public static let operationName: String = "UserID"
+ public static let operationDocument: ApolloAPI.OperationDocument = .init(
+ definition: .init(
+ #"query UserID { User(name: "fuwn") { __typename id } }"#
+ ))
+
+ public init() {}
+
+ public struct Data: Tonbo.SelectionSet {
+ public let __data: DataDict
+ public init(_dataDict: DataDict) { __data = _dataDict }
+
+ public static var __parentType: any ApolloAPI.ParentType { Tonbo.Objects.Query }
+ public static var __selections: [ApolloAPI.Selection] { [
+ .field("User", User?.self, arguments: ["name": "fuwn"]),
+ ] }
+
+ /// User query
+ public var user: User? { __data["User"] }
+
+ /// User
+ ///
+ /// Parent Type: `User`
+ public struct User: Tonbo.SelectionSet {
+ public let __data: DataDict
+ public init(_dataDict: DataDict) { __data = _dataDict }
+
+ public static var __parentType: any ApolloAPI.ParentType { Tonbo.Objects.User }
+ public static var __selections: [ApolloAPI.Selection] { [
+ .field("__typename", String.self),
+ .field("id", Int.self),
+ ] }
+
+ /// The id of the user
+ public var id: Int { __data["id"] }
+ }
+ }
+}
diff --git a/Tonbo/Preview Content/Preview Assets.xcassets/Contents.json b/Tonbo/Preview Content/Preview Assets.xcassets/Contents.json
new file mode 100644
index 0000000..73c0059
--- /dev/null
+++ b/Tonbo/Preview Content/Preview Assets.xcassets/Contents.json
@@ -0,0 +1,6 @@
+{
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/Tonbo/Schema/Objects/Query.graphql.swift b/Tonbo/Schema/Objects/Query.graphql.swift
new file mode 100644
index 0000000..3ebe37d
--- /dev/null
+++ b/Tonbo/Schema/Objects/Query.graphql.swift
@@ -0,0 +1,12 @@
+// @generated
+// This file was automatically generated and should not be edited.
+
+import ApolloAPI
+
+public extension Objects {
+ static let Query = ApolloAPI.Object(
+ typename: "Query",
+ implementedInterfaces: [],
+ keyFields: nil
+ )
+} \ No newline at end of file
diff --git a/Tonbo/Schema/Objects/User.graphql.swift b/Tonbo/Schema/Objects/User.graphql.swift
new file mode 100644
index 0000000..cd0bf77
--- /dev/null
+++ b/Tonbo/Schema/Objects/User.graphql.swift
@@ -0,0 +1,13 @@
+// @generated
+// This file was automatically generated and should not be edited.
+
+import ApolloAPI
+
+public extension Objects {
+ /// A user
+ static let User = ApolloAPI.Object(
+ typename: "User",
+ implementedInterfaces: [],
+ keyFields: nil
+ )
+} \ No newline at end of file
diff --git a/Tonbo/Schema/SchemaConfiguration.swift b/Tonbo/Schema/SchemaConfiguration.swift
new file mode 100644
index 0000000..8723501
--- /dev/null
+++ b/Tonbo/Schema/SchemaConfiguration.swift
@@ -0,0 +1,15 @@
+// @generated
+// This file was automatically generated and can be edited to
+// provide custom configuration for a generated GraphQL schema.
+//
+// Any changes to this file will not be overwritten by future
+// code generation execution.
+
+import ApolloAPI
+
+public enum SchemaConfiguration: ApolloAPI.SchemaConfiguration {
+ public static func cacheKeyInfo(for type: ApolloAPI.Object, object: ApolloAPI.ObjectData) -> CacheKeyInfo? {
+ // Implement this function to configure cache key resolution for your schema types.
+ return nil
+ }
+}
diff --git a/Tonbo/Schema/SchemaMetadata.graphql.swift b/Tonbo/Schema/SchemaMetadata.graphql.swift
new file mode 100644
index 0000000..2607e16
--- /dev/null
+++ b/Tonbo/Schema/SchemaMetadata.graphql.swift
@@ -0,0 +1,32 @@
+// @generated
+// This file was automatically generated and should not be edited.
+
+import ApolloAPI
+
+public protocol SelectionSet: ApolloAPI.SelectionSet & ApolloAPI.RootSelectionSet
+where Schema == Tonbo.SchemaMetadata {}
+
+public protocol InlineFragment: ApolloAPI.SelectionSet & ApolloAPI.InlineFragment
+where Schema == Tonbo.SchemaMetadata {}
+
+public protocol MutableSelectionSet: ApolloAPI.MutableRootSelectionSet
+where Schema == Tonbo.SchemaMetadata {}
+
+public protocol MutableInlineFragment: ApolloAPI.MutableSelectionSet & ApolloAPI.InlineFragment
+where Schema == Tonbo.SchemaMetadata {}
+
+public enum SchemaMetadata: ApolloAPI.SchemaMetadata {
+ public static let configuration: any ApolloAPI.SchemaConfiguration.Type = SchemaConfiguration.self
+
+ public static func objectType(forTypename typename: String) -> ApolloAPI.Object? {
+ switch typename {
+ case "Query": return Tonbo.Objects.Query
+ case "User": return Tonbo.Objects.User
+ default: return nil
+ }
+ }
+}
+
+public enum Objects {}
+public enum Interfaces {}
+public enum Unions {}
diff --git a/Tonbo/Tonbo.entitlements b/Tonbo/Tonbo.entitlements
new file mode 100644
index 0000000..53000f3
--- /dev/null
+++ b/Tonbo/Tonbo.entitlements
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>aps-environment</key>
+ <string>development</string>
+ <key>com.apple.developer.aps-environment</key>
+ <string>development</string>
+ <key>com.apple.developer.icloud-container-identifiers</key>
+ <array/>
+ <key>com.apple.developer.icloud-services</key>
+ <array>
+ <string>CloudKit</string>
+ </array>
+ <key>com.apple.security.app-sandbox</key>
+ <true/>
+ <key>com.apple.security.files.user-selected.read-only</key>
+ <true/>
+</dict>
+</plist>
diff --git a/Tonbo/TonboApp.swift b/Tonbo/TonboApp.swift
new file mode 100644
index 0000000..b9ed870
--- /dev/null
+++ b/Tonbo/TonboApp.swift
@@ -0,0 +1,23 @@
+import SwiftData
+import SwiftUI
+
+@main
+struct TonboApp: 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)
+ }
+}