Author Archives: Coke

About Coke

Web/Mobile Developer

docker completion for zprezto

ln -s /Applications/ /usr/local/share/zsh/site-functions/_docker
ln -s /Applications/ /usr/local/share/zsh/site-functions/_docker-machine
ln -s /Applications/ /usr/local/share/zsh/site-functions/_docker-compose

Singletons in Objective-C



@interface ShareObject : NSObject {
    NSString *someVariable;

@property (nonatomic, retain) NSString *someVariable;

+ (id)sharedManager;



#import "ShareObject.h"

@implementation ShareObject

@synthesize someVariable;

+ (id)sharedManager {
    static ShareObject *shareObject = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        shareObject = [[self alloc] init];
    return shareObject;

- (id)init {
    if (self = [super init]) {
        someVariable = @"some value";
    return self;

- (void)dealloc {
    // Should never be called, but just here for clarity really.


How to use

ShareObject *shareObject = [ShareObject sharedManager];

Hello world!

กลับมาเขียน blog ใหม่อีกครั้งไว้มีเวลา จะหาเรื่องราวมาแชร์ แล้วกัน