ZHNBaseSingleton 0.0.4

ZHNBaseSingleton 0.0.4

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Sep 2015

Maintained by Zhn.



  • By
  • Zhn

Singleton with one line implementation.

Podfile

platform :ios, '7.0'
pod "ZHNBaseSingleton"

Usage

1. Inherit your class from ZHNBaseSingleton:

.h file:

@interface ChildSingleton : ZHNBaseSingleton

@end

2. Override shared function:

.m file:

@implementation ChildSingleton
+ (instancetype)shared
{
    return [ChildSingleton sharedByClass:[ChildSingleton class]];
}
@end

3. Get your instance with shared method:

NSLog(@"%@", [ChildSingleton shared]);

4. Destroy singleton if needed:

[[ChildSingleton shared] destroy];