The shared user interface of the macEM apps, mac4DSTEM and macTEM: the window shell, the controls, the inspector rows, the Metal image view and the spectroscopy room's pieces, as a Swift package. SwiftUI and Metal, with AppKit only where SwiftUI cannot do the job (each such place is named in the code). It holds no numerics: the science lives in the macEM kits, and MacEMUI only draws what an app hands it.
Who it is for. The two macEM apps first. Anyone building a native macOS app for microscopy images and spectra can use it too: the pieces take values and bindings, not an app's model.
| Product | Holds |
|---|---|
ShellMetal |
MetalEngine, MetalImageView, MetalDisplayTransform, the shared colormaps and their shader |
ShellControls |
zoom and pan (pinch, wheel, two-finger scroll), NumericField, PaneFooter, ScaleBar, colorbar, HistogramChart, SegmentedControl |
ShellInspector |
the inspector row kit (InspectorRows) |
ShellLayout |
the window skeleton: rooms (WorkspaceRoom, PanelNavigation), toolbar, sidebar and inspector frames, the centre column, LayoutPolicy, MenuActionRelay, ActivityLog, SystemMonitor |
ShellSpectroscopy |
the spectroscopy room: map tiles and the fitted map grid, the colour mix, regions (draw, edit, list), spectrum and profile panes, the periodic table, the map display popover; the EDS room both apps show (EDXRoom, EDXRoomSettings, EDXRoomInfo, EDXRoomState) |
ShellEDXModel |
the EDS room's model and session (EDXSession, regions, pins, maps, exports), no SwiftUI; the app passes its names and file opener in EDXRoomHost; numbers from SpectroKit |
CHANGELOG.md lists every public piece as it was added.
Requirements: macOS 26, Swift 6.2 tools or newer. It builds with Xcode 27 and with Xcode 26.6.
// Package.swift
dependencies: [
.package(url: "https://github.com/mac4DSTEM/MacEMUI", from: "0.4.0"),
],
targets: [
.target(name: "MyApp", dependencies: [
.product(name: "ShellLayout", package: "MacEMUI"),
.product(name: "ShellMetal", package: "MacEMUI"),
]),
]Import only the modules you use. Versions follow semver; before 1.0 a minor version may change the API, and its CHANGELOG entry has a Migration paragraph saying what to change.
swift build
swift test -c release --parallelThe Metal tests need a GPU; on a machine without one they are skipped, not failed.
GPL-3.0-only. See LICENSE.
