2

My end goal of this task is to have renaming feature similar to what Pages and Sketch have

In the storyboard, I added a NSMenuItem, called Rename..., under File and I linked it to an action called renameDocument (which I believe already implemented in Cocoa). I thought that would be enough, but it wasn't. I thought about overriding the rename method, but I think this should be an easy solution because I think a lot of OS X applications have the same renaming features. I searched through Stack Overflow and google and I got no answers.

My question is: Is there a specific UI element in AppKit which allows me to achieve a similar goal to what Pages and Sketches have done?

Thank you in advance

James Park
  • 91
  • 1
  • 4
  • 3
    You get the Rename functionality for free if you switch [autosaving in place](https://developer.apple.com/documentation/appkit/nsdocument/1515106-autosavesinplace) on. – Willeke Jul 22 '17 at 07:55
  • I already switch autosaving in place to on, but that won't let me rename the file – James Park Jul 24 '17 at 16:49
  • I am also currently having trouble with this at the moment. Can you please elaborate? Are there any other additional steps to take? – J.beenie Jul 27 '17 at 00:29
  • Create a new document based project in Xcode. Add some code to prevent the throw in `data(ofType:)`. Make sure `autosavesInPlace` returns true. Does this test app do what you want? – Willeke Jul 30 '17 at 13:53

0 Answers0