Request for minimal working example with Storyboard
nguyenvukhang opened this issue · 1 comments
nguyenvukhang commented
After trying all sorts of minimal working examples (and failing) just to get one RecorderCocoa
to show up, can I humbly request for a simple "helloworld" level MWE with these settings?
What I've tried so far is to
- Initialize the project as shown above
- Set the
ViewController.swift
file to
import Cocoa
import KeyboardShortcuts
extension KeyboardShortcuts.Name {
static let toggleUnicornMode = Self("toggleUnicornMode")
}
class ViewController: NSViewController {
@IBOutlet var button: NSView!
let recorder = KeyboardShortcuts.RecorderCocoa(for: .toggleUnicornMode)
override func viewDidLoad() {
super.viewDidLoad()
button.addSubview(recorder)
}
}
But nothing shows up. Any help is appreciated. Thanks.
nguyenvukhang commented
Turns out, adding
recorder.frame = CGRect(x: 0, y: 0, width: 100, height: 25)
before button.addSubview(recorder)
is one way to get it to work.