In .h
@interface SOViewController : UIViewController{
NSString * variable;
}
in .m you can set it wherever.
For example, viewDidLoad.
You can also declare this in the .m file by putting the declaration
@interface SOViewController(){
NSString * variable;
}
// @property (strong, nonatomic) NSString * myString; might be appropriate here instead
@end
Before the @implementation.
Ideally, since this is object-oriented programming, though, best practice would be to make the string a property of the class.
If you are really set on the extern keyword here is a stackoverflow post on how to use it Objective C - How to use extern variables?
EDIT
The question came down to how to pass variables around. You can look at this article How to pass prepareForSegue: an object to see an example of how to do that with seguing.