Code Monkey home page Code Monkey logo

almodelmanager's Introduction

/* ______
/ / __ __ __ / / ____ / // / / /_ / /// __ / / // / / / / / / / / // // / / _/// //_// _/_/ */

ALModelManager

Introduction

This is a Observation Object model for using KVO.

Model is so easy creation from JSON Object.

Waring

be carefully Using This.

KVO is not a Simple and hard for Debuging.

Usage

FIRST,

Define to Model from Super class. (model is SubClass for SuperModel)

Like.h

create model like this.

#import "SuperModel.h"
@interface Like : SuperModel
@property (strong, nonatomic) NSString *movie;
@property (strong, nonatomic) NSString *sports;
@property (strong, nonatomic) NSString *something;
@end

and make instance of model using '- (id)initWithDictionary' method not '- (id)init'

more sample & Information : User.h/User.m

SECOND,

imort ALModelManager and declared DataModel`s (Property)

ALModelManager.h
@interface ALModelManager : NSObject
// Here!
@property (strong, nonatomic) Like *likes;
....
+ (ALModelManager *)sharedInstance;
+ (void)releaseInstance;
@end

THIRD,

add Observation and Remove Observation

Viewcontroller.m file
- (id)initWithCoder:(NSCoder *)aDecoder
{
  self = [super initWithCoder:aDecoder];
  if (self) {
      _alt = [[ALTransaction alloc] initWithTarget:self
                                   successSelector:@selector(recieveSuccess:)
                                   failureSelector:@selector(recieveFailure:)];
  }
  return self;
}
- (void)recieveSuccess:(id)result
{
}
- (void)recieveFailure:(id)result
{
}

LAST,

don`t forget Remove all KVO.

AppDelegate.m
- (void)applicationDidEnterBackground:(UIApplication *)application
{
    [self removeAllObservations];
    [self removeAllObservers];
}

that`s it!

Detail Info

Bugs / Feature Requests

Think you’ve found a bug?

Please open a case in issue page.

License

GNU GPL V2 - Read a Lincense file.

References

almodelmanager's People

Contributors

aidenjlee avatar wheeveloper avatar

Watchers

 avatar  avatar  avatar

Forkers

keigun

almodelmanager's Issues

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.