Recently I downloaded the open source project zbar, the project itself it not really relevant to my question, what I still can’t figure out is how in his viewcontroller he is able to do this:
//
// EmbedReaderViewController.h
// EmbedReader
//
// Created by spadix on 5/2/11.
//
#import <UIKit/UIKit.h>
@interface EmbedReaderViewController
: UIViewController
< ZBarReaderViewDelegate >
{
ZBarReaderView *readerView;
UITextView *resultText;
ZBarCameraSimulator *cameraSim;
}
@property (nonatomic, retain) IBOutlet ZBarReaderView *readerView;
@property (nonatomic, retain) IBOutlet UITextView *resultText;
@end
That is it, that is the whole file, how can he see the delegate and the ZBarReaderView and ZBarCameraSimulator, without importing anything???.
My implementation is working, but I of course have to import the files, and as I was looking at the example, it really caught my attention that he was not importing anything… how is that possible??
Projects usually have a
pchfile (pre-compiled/prefix header) in them; this file is automatically included in every other code file of the project. If thepchfile contains an#importto the protocol file, then every file in the project will be aware of it.