Re: NSDocument willPresentError(_:) in Swift 4 : Override not called
Re: NSDocument willPresentError(_:) in Swift 4 : Override not called
- Subject: Re: NSDocument willPresentError(_:) in Swift 4 : Override not called
- From: Jerome Krinock <email@hidden>
- Date: Fri, 30 Jun 2017 06:03:27 -0700
> On 2017 Jun 29, at 23:37, Quincey Morris
> <email@hidden> wrote:
>
> You would get an error trying to declare the override if it did not have the
> correct method signature.
Yes, of course. To be honest, most of the time, I don't really *write* Swift.
I throw some characters onto the screen and click “Fix” :))
> In what class are you doing the “presentError” invocation?
In my NSDocument subclass.
Anyhow, after retrying this morning, I found that it works as expected. I
think I was fooled by the fact that, in the Xcode template document-based Cocoa
app, clicking File > Duplicate gives a different behavior (it opens a new
document in a new window, a "real Duplicate") than typing its displayed
keyboard shortcut ⌘⇧S (it prompts a new file path on the frontmost document, an
old-fashioned “Save As"). It works the same in Apple’s TextEdit.app, but I’d
never noticed this.
Well, it turns out that only the “real duplicate” operation invokes
-willPresentError: when user attempts to overwrite an existing document.
Weird, but a distraction from my present purpose. Maybe a topic for a future
thread.
As always, if Quincey Morris doesn’t know the answer, my question was malformed
:)
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden