GithubHelp home page GithubHelp logo

ainame / ameenumeratedobject Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 200 KB

[deprecated] AMEEnumeratedObject provide defining method to create a enum object as a plain old objc object.

License: MIT License

Objective-C 88.72% Ruby 11.28%

ameenumeratedobject's Introduction

AMEEnumeratedObject

CI Status Version License Platform

Usage

@interface Alphabets : AMEEnumeratCollection; @end
@interface Alphabet : AMEEnumeratedObject
+ (Alphabet *)enumObject;
@end;
@implementation Alphabet;  @end
@interface A : Alphabet; @end; @implementation A; @end
@interface B : Alphabet; @end; @implementation B; @end
@interface C : Alphabet; @end; @implementation C; @end

@implementation Alphabets
+ (NSArray *) values
{
    return @[
        [A defineEnum:0 name:@"a" description:@"えー"],
        [B defineEnum:1 name:@"b" description:@"びー"],
        [C defineEnum:2 name:@"c" description:@"しー"],
    ];
}
@end

// ....

[AMEEnumeratedObjectInitializer initializeAllEnumerateObjects];
Alphabet *alphabet = [A enumObject];
alphabet.ordinal; //=> 0
alphabet.name; //=> @"a"
alphabet.description; //=> @"えー"

alphabet = [Alphabets valueForName:@"b"] // => B object;
[Alphabets values]                       // => A, B and c instances as NSArray;

Requirements

Installation

AMEEnumeratedObject is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "AMEEnumeratedObject"

Author

ainame

License

AMEEnumeratedObject is available under the MIT license. See the LICENSE file for more info.

ameenumeratedobject's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.