The compiler doesn't give me any error and the code runs. Just curious how can I check the contents of my array after adding a new element.
In my .h file
@interface AddCardViewController : UIViewController <UITextFieldDelegate>
@property (strong, nonatomic) IBOutlet UITextField *cardNameTextField;
@end
In my .m file
@interface AddCardViewController ()
@property (nonatomic, strong)NSMutableArray *nameOfCards;
@end
@implementation AddCardViewController
@synthesize cardNameTextField = _cardNameTextField;
@synthesize nameOfCards = _nameOfCards;
- (NSMutableArray *)nameOfCards
{
if (!_nameOfCards)
_nameOfCards = [[NSMutableArray alloc] init];
return _nameOfCards;
}
- (IBAction)addNewCard:(id)sender {
[_nameOfCards addObject:self.cardNameTextField.text];
}
@end