{"action":"created","issue":{"url":"https://api.github.com/repos/SwiftBond/Bond/issues/63","labels_url":"https://api.github.com/repos/SwiftBond/Bond/issues/63/labels{/name}","comments_url":"https://api.github.com/repos/SwiftBond/Bond/issues/63/comments","events_url":"https://api.github.com/repos/SwiftBond/Bond/issues/63/events","html_url":"https://github.com/SwiftBond/Bond/issues/63","id":78547221,"number":63,"title":"IMK STALL detected, *please Report* your user scenario in <rdar://problem/16792073> - (imkxpc_bundleIdentifierWithReply:) block performed very slowly (16.02 secs)","user":{"login":"juandent","id":5367573,"avatar_url":"https://avatars.githubusercontent.com/u/5367573?v=3","gravatar_id":"","url":"https://api.github.com/users/juandent","html_url":"https://github.com/juandent","followers_url":"https://api.github.com/users/juandent/followers","following_url":"https://api.github.com/users/juandent/following{/other_user}","gists_url":"https://api.github.com/users/juandent/gists{/gist_id}","starred_url":"https://api.github.com/users/juandent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juandent/subscriptions","organizations_url":"https://api.github.com/users/juandent/orgs","repos_url":"https://api.github.com/users/juandent/repos","events_url":"https://api.github.com/users/juandent/events{/privacy}","received_events_url":"https://api.github.com/users/juandent/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-05-20T14:26:52Z","updated_at":"2015-05-23T10:20:16Z","closed_at":null,"body":"I am getting this error when I run a small sample app:\r\n\r\nIMK Stall detected, please Report your user scenario in rdar://problem/16792073 - (imkxpc_bundleIdentifierWithReply:) block performed very slowly (16.02 secs)\r\n\r\nI run MAC OS X 10.10.3 on MacBookPro\r\n\r\n??\r\n\r\nThanks.,\r\nJuan Dent"},"comment":{"url":"https://api.github.com/repos/SwiftBond/Bond/issues/comments/104879170","html_url":"https://github.com/SwiftBond/Bond/issues/63#issuecomment-104879170","issue_url":"https://api.github.com/repos/SwiftBond/Bond/issues/63","id":104879170,"user":{"login":"srdanrasic","id":1660804,"avatar_url":"https://avatars.githubusercontent.com/u/1660804?v=3","gravatar_id":"","url":"https://api.github.com/users/srdanrasic","html_url":"https://github.com/srdanrasic","followers_url":"https://api.github.com/users/srdanrasic/followers","following_url":"https://api.github.com/users/srdanrasic/following{/other_user}","gists_url":"https://api.github.com/users/srdanrasic/gists{/gist_id}","starred_url":"https://api.github.com/users/srdanrasic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srdanrasic/subscriptions","organizations_url":"https://api.github.com/users/srdanrasic/orgs","repos_url":"https://api.github.com/users/srdanrasic/repos","events_url":"https://api.github.com/users/srdanrasic/events{/privacy}","received_events_url":"https://api.github.com/users/srdanrasic/received_events","type":"User","site_admin":false},"created_at":"2015-05-23T10:20:16Z","updated_at":"2015-05-23T10:20:16Z","body":"@juandent, you're on good track, just mind your Types:\r\n\r\n```swift\r\nclass NSComboBoxDynamicHelper: NSObject {\r\n  \r\n  weak var control: NSComboBox?\r\n  var listener: (Int -> Void)?\r\n  \r\n  init(control: NSComboBox) {\r\n    self.control = control\r\n    super.init()\r\n    control.target = self\r\n    control.action = Selector(\"selectionChanged:\")\r\n  }\r\n  \r\n  func selectionChanged(sender: AnyObject?) {\r\n    if let combo : NSComboBox = sender as? NSComboBox {\r\n      let index = combo.indexOfSelectedItem\r\n      self.listener?(index)\r\n    }\r\n  }\r\n}\r\n\r\nclass NSComboBoxDynamicForIndex<T>: InternalDynamic<Int> {\r\n  \r\n  let helper: NSComboBoxDynamicHelper\r\n  \r\n  init(control: NSComboBox) {\r\n    self.helper = NSComboBoxDynamicHelper(control: control)\r\n    super.init(control.indexOfSelectedItem )\r\n    self.helper.listener =  { [unowned self] in\r\n      self.updatingFromSelf = true\r\n      self.value = $0\r\n      self.updatingFromSelf = false\r\n    }\r\n  }\r\n}\r\n\r\nclass NSComboBoxDynamicForObject<T>: InternalDynamic<AnyObject?> {\r\n  \r\n  let helper: NSComboBoxDynamicHelper\r\n  \r\n  init(control: NSComboBox) {\r\n    self.helper = NSComboBoxDynamicHelper(control: control)\r\n    super.init(nil)\r\n    self.helper.listener = { [unowned self, unowned control] in\r\n      self.updatingFromSelf = true\r\n      self.value = control.objectValues[$0]\r\n      self.updatingFromSelf = false\r\n    }\r\n  }\r\n}\r\n\r\nprivate var indexOfSelectedItemDynamicHandleNSComboBox: UInt8 = 0;\r\nprivate var objectValueOfSelectedItemDynamicHandleNSComboBox : UInt8 = 0;\r\n\r\nextension NSComboBox: Dynamical, Bondable {\r\n  \r\n  public var dynIndexOfSelectedItem: Dynamic<Int> {\r\n    \r\n    if let d: AnyObject = objc_getAssociatedObject(self, &indexOfSelectedItemDynamicHandleNSComboBox) {\r\n      return (d as? Dynamic<Int>)!\r\n    } else {\r\n      let d = NSComboBoxDynamicForIndex<Int>(control: self)\r\n      let bond = Bond<Int>() { [weak self, weak d] v in\r\n        if let s = self, d = d where !d.updatingFromSelf {  // prevents feedback loop\r\n          let itemCount = s.numberOfItems\r\n          if v > -1 && v < itemCount {\r\n            s.selectItemAtIndex(v)\r\n          }\r\n        }\r\n      }\r\n      d.bindTo(bond, fire: false, strongly: false)\r\n      d.retain(bond)\r\n      objc_setAssociatedObject(self, &indexOfSelectedItemDynamicHandleNSComboBox, d, objc_AssociationPolicy(OBJC_ASSOCIATION_RETAIN_NONATOMIC))\r\n      return d\r\n    }\r\n  }\r\n  \r\n  public var dynObjectValueOfSelectedItem : Dynamic<AnyObject?> {\r\n    \r\n    if let d: AnyObject = objc_getAssociatedObject(self, &objectValueOfSelectedItemDynamicHandleNSComboBox) {\r\n      return (d as? Dynamic<AnyObject?>)!\r\n      \r\n    } else {\r\n      let d = NSComboBoxDynamicForObject<AnyObject?>(control: self)\r\n      let bond = Bond<AnyObject?>() { [weak self, weak d] v in\r\n        if let s = self, d = d where !d.updatingFromSelf {  // prevents feedback loop\r\n          s.objectValue = v\r\n        }\r\n      }\r\n      d.bindTo(bond, fire: false, strongly: false)\r\n      d.retain(bond)\r\n      objc_setAssociatedObject(self, &objectValueOfSelectedItemDynamicHandleNSComboBox, d, objc_AssociationPolicy(OBJC_ASSOCIATION_RETAIN_NONATOMIC))\r\n      return d\r\n    }\r\n  }\r\n}\r\n\r\npublic func <->> (left: NSComboBox, right: Dynamic<Int>) {\r\n  left.dynIndexOfSelectedItem <->> right\r\n}\r\n\r\npublic func <->> (left: Dynamic<Int>, right: NSComboBox) {\r\n  left <->> right.dynIndexOfSelectedItem\r\n}\r\n```\r\n\r\n"}}