Mimic the macOS bezel
Add the following to your dependencies
in Package.swift
:
.package(url: "https://github.com/dimitarnestorov/MacBezel", .upToNextMinor(from: "0.1.0")),
import MacBezel
Bezel.show(NSImage(named: "done")!, options: [.text: "Done"])
import MacBezel
let image = NSImage(systemSymbolName: "lock", accessibilityDescription: nil)!
.withSymbolConfiguration(.init(pointSize: 500, weight: .medium, scale: .large))!
.resizeForBezel()
Bezel.show(image, options: [.text: "Locked"])
Icons should be 174 x 174 points. Icons that will be displayed with the text option should position their content in a 115 x 115 points padded 29.5 points from the left and 43 points from the bottom.
For best results use a vector image and set "Render As" to "Template Image".
If you want to use an SF Symbol or another icon library MacBezel comes with an extension to NSImage
:
/// Returns a new NSImage appropriately resized for MacBezel
func resizeForBezel() -> NSImage
Open with Xcode (switch the destination to "My Mac")