Files
ipushto/Classes/MySingleton.m
Norbert Schmidt 025e53504d First commit
2017-09-04 11:40:05 +02:00

64 lines
1.1 KiB
Objective-C
Executable File

//
// MySingleton.m
// IDSC
//
// Created by Norbert Schmidt on 02-02-11.
// Copyright 2011 DDQ. All rights reserved.
//
#import "MySingleton.h"
@implementation MySingleton
@synthesize objectkeuze;
@synthesize rechteklimming;
@synthesize declinatie;
@synthesize objectMagnitude;
@synthesize objectSize;
@synthesize objectNotes;
@synthesize objectType;
@synthesize objectName;
@synthesize objectConst;
static MySingleton* _sharedMySingleton = nil;
+(MySingleton*)sharedMySingleton
{
static MySingleton *sharedSomeClassInstance = nil;
static dispatch_once_t predicate;
dispatch_once(&predicate, ^{
sharedSomeClassInstance = [[self alloc] init];
});
return sharedSomeClassInstance;
}
+(id)alloc
{
@synchronized([MySingleton class])
{
NSAssert(_sharedMySingleton == nil, @"Attempted to allocate a second instance of a singleton.");
_sharedMySingleton = [super alloc];
return _sharedMySingleton;
}
return nil;
}
-(id)init {
self = [super init];
if (self != nil) {
// initialize stuff here
}
return self;
}
@end