mirror of
https://github.com/dscyrescotti/Memola.git
synced 2026-07-07 13:25:09 +02:00
chore: refactor
This commit is contained in:
@@ -8,8 +8,21 @@
|
||||
import Combine
|
||||
import SwiftUI
|
||||
|
||||
class Application: NSObject, ObservableObject {
|
||||
final class Application: NSObject, ObservableObject {
|
||||
|
||||
}
|
||||
|
||||
extension Application {
|
||||
func activateSearchBar() {
|
||||
#if os(macOS)
|
||||
guard let toolbar = NSApp.keyWindow?.toolbar else { return }
|
||||
if let search = toolbar.items.first(where: { $0.itemIdentifier.rawValue == "com.apple.SwiftUI.search" }) as? NSSearchToolbarItem {
|
||||
search.beginSearchInteraction()
|
||||
}
|
||||
#else
|
||||
#warning("TODO: implement for ipad")
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#if os(macOS)
|
||||
|
||||
@@ -10,9 +10,9 @@ import SwiftUI
|
||||
@main
|
||||
struct MemolaApp: App {
|
||||
#if os(macOS)
|
||||
@NSApplicationDelegateAdaptor(Application.self) var application
|
||||
@NSApplicationDelegateAdaptor(Application.self) private var application
|
||||
#else
|
||||
@UIApplicationDelegateAdaptor(Application.self) var application
|
||||
@UIApplicationDelegateAdaptor(Application.self) private var application
|
||||
#endif
|
||||
|
||||
var body: some Scene {
|
||||
@@ -30,6 +30,7 @@ struct MemolaApp: App {
|
||||
#if os(macOS)
|
||||
.frame(minWidth: 1000, minHeight: 600)
|
||||
#endif
|
||||
.environmentObject(application)
|
||||
}
|
||||
#if os(macOS)
|
||||
.defaultPosition(.center)
|
||||
@@ -41,7 +42,7 @@ struct MemolaApp: App {
|
||||
AppCommands()
|
||||
FileCommands()
|
||||
EditCommands()
|
||||
ViewCommands()
|
||||
ViewCommands(application: application)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user