// // HardwareGate.swift // Zyquo MLX // // Author: Simon-Pierre Boucher // Mail: contact@spboucher.ai // import Foundation import SwiftUI /// MLX requires Apple Silicon. The binary itself is arm64-only, so on an /// Intel Mac it will not load at all — this runtime check is defense in depth /// (e.g. exotic translation environments) and drives the polite /// unsupported-hardware screen required by the project charter. enum HardwareGate { /// True when running natively on Apple Silicon. static let isAppleSilicon: Bool = { var value: Int32 = 0 var size = MemoryLayout.size // hw.optional.arm64 is 1 on Apple Silicon, absent/0 elsewhere. let result = sysctlbyname("hw.optional.arm64", &value, &size, nil, 0) return result == 0 && value == 1 }() } /// Polite, clear unsupported-hardware screen (charter requirement). struct UnsupportedHardwareView: View { var body: some View { VStack(spacing: 16) { Image(systemName: "cpu") .font(.system(size: 48, weight: .light)) .foregroundStyle(.secondary) Text("Apple Silicon Required") .font(.title2.weight(.semibold)) Text("Zyquo MLX is built on MLX, Apple's machine-learning framework, which runs exclusively on Apple Silicon (M-series) Macs. This Mac does not support it.") .multilineTextAlignment(.center) .foregroundStyle(.secondary) .frame(maxWidth: 420) } .padding(48) .frame(minWidth: 560, minHeight: 360) } }