Skip to content

Commit dc8378a

Browse files
authored
Add files via upload
1 parent f0b042b commit dc8378a

18 files changed

Lines changed: 329 additions & 0 deletions

Contents.json

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "ChatGPT Image Jun 9, 2025 at 06_54_20 AM.png",
5+
"idiom" : "universal",
6+
"platform" : "ios",
7+
"size" : "1024x1024"
8+
},
9+
{
10+
"appearances" : [
11+
{
12+
"appearance" : "luminosity",
13+
"value" : "dark"
14+
}
15+
],
16+
"filename" : "ChatGPT Image Jun 9, 2025 at 06_54_20 AM 1.png",
17+
"idiom" : "universal",
18+
"platform" : "ios",
19+
"size" : "1024x1024"
20+
},
21+
{
22+
"appearances" : [
23+
{
24+
"appearance" : "luminosity",
25+
"value" : "tinted"
26+
}
27+
],
28+
"filename" : "ChatGPT Image Jun 9, 2025 at 06_54_20 AM 2.png",
29+
"idiom" : "universal",
30+
"platform" : "ios",
31+
"size" : "1024x1024"
32+
},
33+
{
34+
"filename" : "icon_16x16.png",
35+
"idiom" : "mac",
36+
"scale" : "1x",
37+
"size" : "16x16"
38+
},
39+
{
40+
"filename" : "icon_32x32.png",
41+
"idiom" : "mac",
42+
"scale" : "2x",
43+
"size" : "16x16"
44+
},
45+
{
46+
"filename" : "icon_32x32 1.png",
47+
"idiom" : "mac",
48+
"scale" : "1x",
49+
"size" : "32x32"
50+
},
51+
{
52+
"filename" : "icon_64x64.png",
53+
"idiom" : "mac",
54+
"scale" : "2x",
55+
"size" : "32x32"
56+
},
57+
{
58+
"filename" : "icon_128x128.png",
59+
"idiom" : "mac",
60+
"scale" : "1x",
61+
"size" : "128x128"
62+
},
63+
{
64+
"filename" : "icon_256x256.png",
65+
"idiom" : "mac",
66+
"scale" : "2x",
67+
"size" : "128x128"
68+
},
69+
{
70+
"filename" : "icon_256x256 1.png",
71+
"idiom" : "mac",
72+
"scale" : "1x",
73+
"size" : "256x256"
74+
},
75+
{
76+
"filename" : "icon_512x512.png",
77+
"idiom" : "mac",
78+
"scale" : "2x",
79+
"size" : "256x256"
80+
},
81+
{
82+
"filename" : "icon_512x512 1.png",
83+
"idiom" : "mac",
84+
"scale" : "1x",
85+
"size" : "512x512"
86+
},
87+
{
88+
"filename" : "icon_1024x1024.png",
89+
"idiom" : "mac",
90+
"scale" : "2x",
91+
"size" : "512x512"
92+
}
93+
],
94+
"info" : {
95+
"author" : "xcode",
96+
"version" : 1
97+
}
98+
}

Item.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//
2+
// Item.swift
3+
// Jot
4+
//
5+
// Created by Kiya Rose on 6/9/25.
6+
//
7+
8+
import Foundation
9+
import SwiftData
10+
11+
@Model
12+
final class Item {
13+
var timestamp: Date
14+
15+
init(timestamp: Date) {
16+
self.timestamp = timestamp
17+
}
18+
}

Jot.entitlements

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>com.apple.security.app-sandbox</key>
6+
<true/>
7+
<key>com.apple.security.files.user-selected.read-only</key>
8+
<true/>
9+
</dict>
10+
</plist>

Jot.xcodeproj.zip

19.1 KB
Binary file not shown.

JotApp.swift

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
import SwiftUI
2+
import AppKit
3+
4+
@main
5+
struct ScratchPadApp: App {
6+
@NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
7+
8+
var body: some Scene {
9+
WindowGroup {
10+
ContentViewWrapper()
11+
.frame(minWidth: 300, minHeight: 200)
12+
}
13+
}
14+
}
15+
16+
class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate {
17+
var window: NSWindow?
18+
var contentRef: ContentView?
19+
20+
func applicationDidFinishLaunching(_ notification: Notification) {
21+
if let mainWindow = NSApplication.shared.windows.first {
22+
mainWindow.delegate = self
23+
self.window = mainWindow
24+
}
25+
}
26+
27+
func windowShouldClose(_ sender: NSWindow) -> Bool {
28+
if sender.isDocumentEdited {
29+
let alert = NSAlert()
30+
alert.messageText = "Do you want to quit the app?"
31+
alert.informativeText = "Your notes will be lost if you don't save them elsewhere."
32+
alert.alertStyle = .warning
33+
alert.addButton(withTitle: "Quit")
34+
alert.addButton(withTitle: "Cancel")
35+
36+
let response = alert.runModal()
37+
if response == .alertFirstButtonReturn {
38+
NSApp.terminate(nil)
39+
}
40+
return false
41+
} else {
42+
NSApp.terminate(nil)
43+
return false
44+
}
45+
}
46+
47+
func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
48+
return true
49+
}
50+
}
51+
52+
struct ContentViewWrapper: NSViewControllerRepresentable {
53+
func makeNSViewController(context: Context) -> NSHostingController<ContentView> {
54+
let view = ContentView()
55+
let controller = NSHostingController(rootView: view)
56+
DispatchQueue.main.async {
57+
if let window = controller.view.window {
58+
window.isDocumentEdited = false
59+
window.level = .normal // default level
60+
}
61+
}
62+
return controller
63+
}
64+
65+
func updateNSViewController(_ nsViewController: NSHostingController<ContentView>, context: Context) {}
66+
}
67+
68+
struct ContentView: View {
69+
@State private var text: String = "" {
70+
didSet {
71+
if let window = NSApplication.shared.windows.first {
72+
window.isDocumentEdited = !text.isEmpty
73+
}
74+
}
75+
}
76+
77+
@State private var isPinned: Bool = false
78+
79+
var body: some View {
80+
VStack(spacing: 0) {
81+
HStack {
82+
Button(action: togglePin) {
83+
Image(systemName: isPinned ? "pin.slash" : "pin")
84+
.help(isPinned ? "Unpin Window" : "Pin Window")
85+
}
86+
.buttonStyle(PlainButtonStyle())
87+
.padding(6)
88+
89+
Spacer()
90+
}
91+
.background(Color(NSColor.windowBackgroundColor))
92+
93+
Divider()
94+
95+
TextEditor(text: $text)
96+
.padding(8)
97+
.font(.system(size: 16, design: .monospaced))
98+
.background(Color.white)
99+
}
100+
.frame(maxWidth: .infinity, maxHeight: .infinity)
101+
.onChange(of: text) { oldValue, newValue in
102+
if let window = NSApplication.shared.windows.first {
103+
window.isDocumentEdited = !newValue.isEmpty
104+
}
105+
}
106+
}
107+
108+
private func togglePin() {
109+
guard let window = NSApplication.shared.windows.first else { return }
110+
isPinned.toggle()
111+
window.level = isPinned ? .floating : .normal
112+
}
113+
}

JotTests.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// JotTests.swift
3+
// JotTests
4+
//
5+
// Created by Kiya Rose on 6/9/25.
6+
//
7+
8+
import Testing
9+
10+
struct JotTests {
11+
12+
@Test func example() async throws {
13+
// Write your test here and use APIs like `#expect(...)` to check expected conditions.
14+
}
15+
16+
}

JotUITests.swift

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//
2+
// JotUITests.swift
3+
// JotUITests
4+
//
5+
// Created by Kiya Rose on 6/9/25.
6+
//
7+
8+
import XCTest
9+
10+
final class JotUITests: XCTestCase {
11+
12+
override func setUpWithError() throws {
13+
// Put setup code here. This method is called before the invocation of each test method in the class.
14+
15+
// In UI tests it is usually best to stop immediately when a failure occurs.
16+
continueAfterFailure = false
17+
18+
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
19+
}
20+
21+
override func tearDownWithError() throws {
22+
// Put teardown code here. This method is called after the invocation of each test method in the class.
23+
}
24+
25+
@MainActor
26+
func testExample() throws {
27+
// UI tests must launch the application that they test.
28+
let app = XCUIApplication()
29+
app.launch()
30+
31+
// Use XCTAssert and related functions to verify your tests produce the correct results.
32+
}
33+
34+
@MainActor
35+
func testLaunchPerformance() throws {
36+
// This measures how long it takes to launch your application.
37+
measure(metrics: [XCTApplicationLaunchMetric()]) {
38+
XCUIApplication().launch()
39+
}
40+
}
41+
}

JotUITestsLaunchTests.swift

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
//
2+
// JotUITestsLaunchTests.swift
3+
// JotUITests
4+
//
5+
// Created by Kiya Rose on 6/9/25.
6+
//
7+
8+
import XCTest
9+
10+
final class JotUITestsLaunchTests: XCTestCase {
11+
12+
override class var runsForEachTargetApplicationUIConfiguration: Bool {
13+
true
14+
}
15+
16+
override func setUpWithError() throws {
17+
continueAfterFailure = false
18+
}
19+
20+
@MainActor
21+
func testLaunch() throws {
22+
let app = XCUIApplication()
23+
app.launch()
24+
25+
// Insert steps here to perform after app launch but before taking a screenshot,
26+
// such as logging into a test account or navigating somewhere in the app
27+
28+
let attachment = XCTAttachment(screenshot: app.screenshot())
29+
attachment.name = "Launch Screen"
30+
attachment.lifetime = .keepAlways
31+
add(attachment)
32+
}
33+
}

icon_1024x1024.png

1.32 MB
Loading

icon_128x128.png

11.4 KB
Loading

0 commit comments

Comments
 (0)