SPB Git

spb/zyquo-mlx Public MIT

The local MLX foundry for your Mac — run, fine-tune, quantize, and ship models. Nothing leaves your machine.

Swift 93.4% Python 3.8% Makefile 2.2% Shell 0.5%
1.9 KB · 69 lines swift
Raw Blame History
1//2//  ZyquoMLXApp.swift3//  Zyquo MLX4//5//  Author: Simon-Pierre Boucher6//  Mail: contact@spboucher.ai7//89import SwiftUI1011/// Zyquo MLX — the local MLX foundry for the Mac.12///13/// The SwiftUI application (invoked from `Main` unless CLI mode runs). Gates14/// on Apple Silicon (MLX requires it), activates properly when launched from15/// a terminal, and hosts the main workbench window.16struct ZyquoMLXApp: App {1718    init() {19        // Launching a bare executable from the terminal does not activate it;20        // make sure the window comes to the front like a real Mac app.21        DispatchQueue.main.async {22            NSApplication.shared.setActivationPolicy(.regular)23            NSApplication.shared.activate(ignoringOtherApps: true)24        }25    }2627    @AppStorage("appearance") private var appearance = "system"2829    var body: some Scene {30        WindowGroup {31            Group {32                if HardwareGate.isAppleSilicon {33                    WorkbenchView()34                } else {35                    UnsupportedHardwareView()36                }37            }38            .preferredColorScheme(colorScheme)39        }40        .defaultSize(41            width: ZyquoTheme.defaultWindowSize.width,42            height: ZyquoTheme.defaultWindowSize.height)43        .commands {44            CommandMenu("Foundry") {45                ForEach(WorkbenchSection.allCases) { section in46                    Button(section.title) {47                        NotificationCenter.default.post(48                            name: .zyquoNavigate, object: section)49                    }50                    .keyboardShortcut(section.shortcut, modifiers: .command)51                }52            }53        }5455        Settings {56            SettingsView()57                .preferredColorScheme(colorScheme)58        }59    }6061    private var colorScheme: ColorScheme? {62        switch appearance {63        case "light": .light64        case "dark": .dark65        default: nil66        }67    }68}69