This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
// Create a temporary file URL | |
func createTemporaryFile(fileTitle: String, fileExtension: String) throws -> URL { | |
// Create the file and ensure it exists at the location | |
let tempDirectory = try FileManager.default.url(for: .cachesDirectory, in: .userDomainMask, appropriateFor: .desktopDirectory, create: true) | |
let tempFileURL = tempDirectory.appendingPathComponent(fileTitle).appendingPathExtension(fileExtension) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.commands { | |
CommandGroup(after: CommandGroupPlacement.newItem) { | |
Button("New Command + S Command") { | |
// TO DO: Add Action | |
} | |
.keyboardShortcut("S", modifiers: [.command]) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.commands { | |
CommandGroup(replacing: CommandGroupPlacement.newItem) { | |
// Leave this blank to remove the new window functionality | |
// Or add the element below to replace the New Window command. | |
Button("New Command + N Command") { | |
objectCaptureCoordinator.showModal = true | |
} | |
.keyboardShortcut("N", modifiers: [.command]) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
@main | |
struct Application: App { | |
@FocusState var focused: Bool? | |
// App | |
var body: some Scene { | |
WindowGroup { | |
View() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.focusable() | |
.onKeyPress(action: { key in | |
debugPrint("key: \(key.characters)") | |
return .handled | |
}) | |
.onKeyPress(.upArrow, action: { | |
debugPrint("Up Arrow Key") | |
return .handled | |
}) | |
.onKeyPress(.leftArrow, action: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// _SINGLETON_.swift | |
// | |
// Created by Oscar de la Hera Gomez on 8/28/24. | |
// | |
import Foundation | |
import SwiftUI | |
import SwiftData |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// App.swift | |
// SwiftUI Starter Project | |
// | |
// Created by Oscar de la Hera Gomez on 8/14/24. | |
// | |
import SwiftUI | |
// Please note that "Application" cannot be named App. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// AppDelegate.swift | |
// | |
// Created by Oscar de la Hera Gomez on 10/18/24. | |
// | |
import AppKit | |
class AppDelegate: NSObject, NSApplicationDelegate { | |
func applicationShouldTerminate(_ sender: NSApplication) -> NSApplication.TerminateReply { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.onReceive(NotificationCenter.default.publisher(for: NSApplication.willTerminateNotification)) { _ in | |
// tear down | |
} |