1

I looked here, and went where Macmade said to go. I then deleted everything above #import in the two FILEBASENAME files at File Templates/Cocoa/Objective-C class.xctemplate/NSObject. However, I'm creating new classes in Xcode, derived from NSObject, and I'm getting all the same stuff as before. How can I be rid of it?

(I'm open to the possibility that I shouldn't be getting rid of it, but I don't believe it's useful in the least. Is it?)

Community
  • 1
  • 1

1 Answers1

1

The “junk” is comments, and comments make no difference to the preprocessor, compiler, linker, or user, so there's no harm in getting rid of it.

Like everything else in the file, it comes from the file template you created the file from. You'll need to make copies of the file templates you use and remove the comments from your copies; then, there will be no comments in any files you create in Xcode from the new templates.

I suggest removing the import(s), too, while you're at it. Your prefix header should take care of that; importing system headers anywhere else should be nothing but further noise.

Peter Hosey
  • 95,783
  • 15
  • 211
  • 370
  • I don't see why Apple would include it if it wasn't useful, especially considering the difficulty of omitting it, so I question the "harm" statement. However, I don't see why you'd need any of it - couldn't someone just erase your copyright info if they had your code? A "how" for your other paragraphs should answer my question. –  May 09 '11 at 19:21
  • 1
    @Jessy: There's no difficulty specific to removing the comments; the difficulty is in making any change to the file templates, no matter what the change is. The comments really are just comments, so there really is no harm in removing them. (I didn't say they weren't useful, but comments are only ever useful to people, so if you want them gone, I assume they're not useful to *you*.) And yes, anybody who obtains your code is fully able to remove or change the comments themselves. This other question has a couple of answers to the specific how: http://stackoverflow.com/q/33720/30461 – Peter Hosey May 10 '11 at 00:13
  • (HeaderDoc comments are used by the HeaderDoc tool, and Doxygen comments are used by the Doxygen tool, but the comments in question aren't HeaderDoc or Doxygen comments—they are pure comments, useful only to people, if they are useful at all.) – Peter Hosey May 10 '11 at 00:17
  • The information at that link is outdated; the system paths differ, and as I said in the question, editing the files made no difference. –  May 10 '11 at 17:19
  • @Jessy: This page describes the changes in Xcode 4: http://gallantgames.com/post/3771670972/xcode-4-templates Additionally, you can add new templates in Xcode 4 itself: http://developer.apple.com/library/mac/documentation/ToolsLanguages/Conceptual/Xcode4UserGuide/Editing/Editing.html – Peter Hosey May 10 '11 at 19:12
  • I don't see a way to make a new template there, and I don't want to anyway. I want all of the comments gone from, for example – and let's start there because it's what I currently, as a neophyte, am finding myself needing most often – an Objective-C class that derives from NSObject. –  May 11 '11 at 07:19
  • @Jessy: There is no way to change one of Apple's templates. (Even if you did, your changes would be overwritten the next time you updated Xcode.) You need to make a new template and remove the comments from that. – Peter Hosey May 11 '11 at 16:19