Swiftpack.co - tyagishi/FontPicker as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by tyagishi.
tyagishi/FontPicker 1.2.0
FontPicker on macOS
⭐️ 13
🕓 29 weeks ago
macOS
.package(url: "https://github.com/tyagishi/FontPicker.git", from: "1.2.0")

FontPicker

Wrapped NSFontPanel for SwiftUI.

UI

FontPickerExample

for working example, please refer to https://github.com/tyagishi/FontPickerExample

example code

FontPicker can be used like ColorPicker.

struct ContentView: View {
    @State private var font: NSFont = NSFont.systemFont(ofSize: 24)
    var body: some View {
        VStack {
            FontPicker("Font", selection: $font)
            Text("selected font name \(font.displayName ?? "no font" )")
            Text("font size: \(font.pointSize, specifier: "%.0f")")
        }
    }
}

small improvement

As usual user can close FontPanel with close button of FontPanel. Additionally: user can close FontPanel with second clicking FontPicker button. (i.e. Clicking FontPicker button while FontPanel is still open FontPanel will be closed.)

comments are welcome

Comments, advice for improvements are highly appreciated. please contact to https://twitter.com/tyagishi .

GitHub

link
Stars: 13
Last commit: 29 weeks ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Related Packages

Release Notes

1.2.0
29 weeks ago

What's Changed

New Contributors

Full Changelog: https://github.com/tyagishi/FontPicker/compare/1.1.0...1.2.0

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics