How can I cast an Object to Person to access its property something like
((Person)self.dataObject).firstName;
except that clang doesn't accept this syntax :
DataViewController.h
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
self.dataLabel.text = ((Person)self.dataObject).firstName;
}
DataViewController.h
#import <UIKit/UIKit.h>
@interface DataViewController : UIViewController
@property (strong, nonatomic) IBOutlet UILabel *dataLabel;
@property (strong, nonatomic) id dataObject;
@end
Person.h
#import <Foundation/Foundation.h>
@interface Person : NSObject
@property NSString* firstName;
@property NSString* lastName;
@end