-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swift usage #18
Comments
I got this to work. If anyone else is having trouble getting this to work from Swfit, drop a comment here and I'll try to help. The basics were:
class AppDelegate: NSObject, NSApplicationDelegate {
var statusItemPopup: AXStatusItemPopup?
@IBOutlet var window: NSWindow
@IBOutlet var showPopupBtn: NSButton
@IBAction func showPopupBtnAction(sender: NSButton) {
statusItemPopup?.showPopoverAnimated(true)
}
func applicationDidFinishLaunching(aNotification: NSNotification?) {
// Insert code here to initialize your application
// init the content view controller
// which will be shown inside the popover.
var myContentViewController = ContentViewController(nibName: "ContentViewController", bundle: NSBundle.mainBundle())
// init the status item popup
var image = NSImage(named: "cloud")
var alternateImage = NSImage(named: "cloudgrey")
statusItemPopup = AXStatusItemPopup(viewController: myContentViewController, image: image, alternateImage: alternateImage);
// Set the popover to the contentview to e.g. hide it from there.
myContentViewController.statusItemPopup = statusItemPopup;
}
func applicationWillTerminate(aNotification: NSNotification?) {
// Insert code here to tear down your application
}
} |
Can you show your "ContentViewController.Swift" Code please Many Thanks 👍 |
Hi — feel free to check out the whole project where I have used AXStatusItemPopup inside Swift: https://github.com/jeff-h/duckdns It's a work-in-progress as I learn Swift, but the popup part of the project works fine. |
Thanks Jeff, I'll check it out. |
Very Nice and clean solution 👍 I have already implement it to my project and it's working like a charm |
I'm wondering if you could give a quick example of how to use this from inside Swift? I have created the
MyProject-Bridging-Header.h
containing#import "AXStatusItemPopup.h"
and can now do the following:but that's as far as I can work out. Xcode's autocomplete suggests the following, which makes no sense to me and doesn't seem to align with any of the methods defined on AXStatusItemPopup:
The text was updated successfully, but these errors were encountered: