Latest 0.0.1
Homepage https://github.com/ocgungor/OCGStack
License Apache
Platforms osx , ios , tvos , watchos , requires ARC

A simple Stack implementation using NSMutableArray

Homemade Stack implementation using NSMutableArray in Objective-C.
Based on https://en.wikipedia.org/wiki/Stack_(abstract_data_type)

Installation

    pod 'OCGStack'

Usage

Init

OCGStack *stack = [OCGStack stackWithObjects:@"ocg", @"booka", nil];

    OR

OCGStack *stack = [[OCGStack alloc] init];

Add objects to your stack

[stack pushObject:@"hello world"];

Retrieve your object at the top of your stack without removing it

[stack peekObject];

Pop an object off your stack

[stack popObject];

Swap the two elements at the top of your stack

[stack swapTopMostObjects];

Check if your stack is empty

stack.isEmpty;

Latest podspec

{
    "name": "OCGStack",
    "version": "0.0.1",
    "summary": "A simple Stack implementation using NSMutableArray",
    "description": "Homemade Stack implementation using NSMutableArray in Objective-C.",
    "homepage": "https://github.com/ocgungor/OCGStack",
    "license": {
        "type": "Apache",
        "file": "LICENSE"
    },
    "authors": "Oguzhan Gungor",
    "source": {
        "git": "https://github.com/ocgungor/OCGStack.git",
        "tag": "0.0.1"
    },
    "source_files": [
        "Classes",
        "OCGStack/Classes/**/*.{h,m}"
    ],
    "exclude_files": "Classes/Exclude",
    "requires_arc": true,
    "platforms": {
        "osx": null,
        "ios": null,
        "tvos": null,
        "watchos": null
    }
}

Pin It on Pinterest

Share This