Empresa engajada
Implement the m file @protocol Stack <NSObject> @property (nonatomic, readonly) NSInteger count; - (void)pushObject:(nonnull id)object; - (nullable id)popObject; @end
Sigiloso
@interface Stack () NSMutuableArray * stackArr; @end @implementation Stack () -(id) init { stackArr = [[NSMutuableArray alloc] init]; _count = 0; return self; } - (void)pushObject:(nonnull id)object { [stackArr addObject:object]; self.count++; } - (nullable id)popObject { if(count == 0) return null; else { self.count--; return [stackArr objectAtIndex(self.count)]; } }