• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSDocument willPresentError(_:) in Swift 4 : Override not called
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: NSDocument willPresentError(_:) in Swift 4 : Override not called
      • From: Quincey Morris <email@hidden>
References: 
 >NSDocument willPresentError(_:) in Swift 4 : Override not called (From: Jerome Krinock <email@hidden>)
 >Re: NSDocument willPresentError(_:) in Swift 4 : Override not called (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: NSDocument willPresentError(_:) in Swift 4 : Override not called
  • Next by Date: Re: Focus ring of NSComboBox and text field visible through overlaid views
  • Previous by thread: Re: NSDocument willPresentError(_:) in Swift 4 : Override not called
  • Next by thread: Re: NSDocument willPresentError(_:) in Swift 4 : Override not called
  • Index(es):
    • Date
    • Thread