osx - EventMonitor .LeftMouseDownMask Type of expression is ambiguous without more context -


i learning make status bar application xcode using swift 2. have completed tutorial, on line eventmonitor = eventmonitor(mask: . | .rightmousedownmask) { [unowned self] event in, .leftmousedownmask gives me error saying type of expression ambiguous without more context. how fix type of expression issue?

here appdelegate.swift file:

import cocoa  @nsapplicationmain class appdelegate: nsobject, nsapplicationdelegate {      @iboutlet weak var window: nswindow!      //event monitering     var eventmonitor: eventmonitor?     ///////////////////     let statusitem = nsstatusbar.systemstatusbar().statusitemwithlength(-2)     let popover = nspopover()       func applicationdidfinishlaunching(notification: nsnotification) {         if let button = statusitem.button {             button.image = nsimage(named: "statusbarbuttonimage")             button.action = selector("togglepopover:")         }          popover.contentviewcontroller = quotesviewcontroller(nibname: "quotesviewcontroller", bundle: nil)          //event monitering         eventmonitor = eventmonitor(mask: .leftmousedownmask | .rightmousedownmask) { [unowned self] event in             if self.popover.shown {                 self.closepopover(event)             }         }         eventmonitor?.start()         //////////////////////     }      func applicationwillterminate(anotification: nsnotification) {         // insert code here tear down application     }       func showpopover(sender: anyobject?) {         if let button = statusitem.button {             popover.showrelativetorect(button.bounds, ofview: button, preferrededge: nsrectedge.miny)         }     }      func closepopover(sender: anyobject?) {         popover.performclose(sender)     }      func togglepopover(sender: anyobject?) {         if popover.shown {             closepopover(sender)         } else {             showpopover(sender)         }     }   } 

i guessing error because .leftmousedownmask has changed else in swift 2 since tutorial made in swift 1 (and had few other compatibility issues too).

fixed issue.

i had change line eventmonitor = eventmonitor(mask: .leftmousedownmask | .rightmousedownmask) { [unowned self] event in eventmonitor = eventmonitor(mask: [.leftmousedownmask, .rightmousedownmask]) { [unowned self] event in.


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -