Reputation: 59
I get the feeling that this is a very stupid question, but I cannot find an answer anywhere. I've created a new class in an XCode project called "Word", with its own .h and .m files, which inherits from NSString, and has its own declared instance variable, method, etc. How do I access it within the viewcontroller.h and .m files? I though it would just show up in the little suggestion box in XCode, like the pre-made classe, but it doesn't. How do I use my new class?
Upvotes: 0
Views: 49
Reputation: 456
in your .h, at the top type #import "
then start typing Word.h. It should autocomplete if the .h and .m files are in your project correctly.
Upvotes: 1
Reputation: 299575
#import "Word.h"
I will note that subclassing NSString
is extremely uncommon and almost never what you mean to do. You probably meant to have Word
have an NSString
property.
Upvotes: 3
Reputation: 859
You just need to add the following to your ViewController.h
#import "Word.h"
Upvotes: 0