1

I'm not sure the title makes much sense, I'm having problems asking (and google searching) for a solution to the below question in a single coherent sentence.

I've created a custom class with the sole intention of subclassing it. I have a single method that I'll need to override when writing a new subclass. What I'm looking to do is, when I create a new file, and choose my custom class to subclass I'd like for the new implementation file to already have an empty version of the method. Similar to how an init method, or a drawRect method (when appropriate) is already in the implementation file when creating a new class.

Does that make sense?

Kris
  • 349
  • 1
  • 2
  • 13

1 Answers1

3

You can define a template in your editor to do that. But there is no mechanism in Objective-C language that can do exactly that.

However, you could create a protocol with a required method and implement that (instead of subclassing an existing class), if that fits your need. This gives you a compile error if you forget to implement the method.

driis
  • 161,458
  • 45
  • 265
  • 341