Posts

Post marked as solved
3 Replies
OK, it was really easy: I just needed to create an action in the First Responder and connect the NSMenuItem to the new Action.Then once implemented a function in the NSViewController with the same name of the action created in the First Responder, my function has been called :-)
Post marked as solved
3 Replies
Hi Claude,thanks for your reply.Yes, if I disconnect from the firstresponder.print the only effect I have is that the menu item is no more available (grayed). It cannot still be connected to any IBAction :-(
Post not yet marked as solved
1 Replies
Hi there,have a look here please: https://developer.apple.com/support/forums/Apple/Apple Employee may provide answer in this forum but without any SLA. Being in you, I would try to "bump" the thread you opened, hopping to receive support :-)
Post not yet marked as solved
5 Replies
Hi John,thanks for your reply.I have tried this approach but I have the same situation.Now the init do not contains any drawing stuff.I have the override of the "draw" (the "native" draw method of the NSView) in which I call my code:public override func draw(_ rect : CGRect) { // "configuration stuff here" if (self.needsToRefresh) { self.drawMyStuff(rect: rect) }then I have@objc func drawMyStuff(rect : CGRect) { let width = Double(rect.size.width) let height = Double(rect.size.height) for x in stride(from: 0, to: width, by: blockiness) { for y in stride(from: 0, to: height, by: blockiness) { NSBezierPath.fill(CGRect(x: x, y: y, width: blockiness, height: blockiness)) } } self.setNeedsDisplay(rect) }The result is like before, instead of seeing a rectagle filled step by step, I see after some seconds the rectangle completely filled and it looks to me that this is a kind of normal behavior because the drawig is executed in the same thread of the caller :-/
Post not yet marked as solved
5 Replies
Hi Claude,thanks for your hints.Yes, I did it but without changing the result: the View is rendere all in one at the end of the execution of the method.Something else I tried was to execute the method in a separate thread, something like this:DispatchQueue.main.async { // some code here self.drawMandelbrot(rect: rect) }But the first problem is that then the NSGraphicsContext.current is nul and if even I manag to pass as a parameter the context, again same result :-(