How write singleton class setup in swift 3.0. Currently i am using this code in objective c . How write singleton class setup in swift 3.0. Currently i am using this code in objective c
 #pragma mark Singleton
static ModelManager* _instance = nil;
+ (ModelManager *) sharedInstance {
@synchronized([ModelManager class]){
    if (!_instance) {
        _instance = [[self alloc] init];
    }
    return _instance;
}
return nil;
}
+ (id)alloc {
@synchronized([ModelManager class]){
    NSAssert(_instance == nil, @"Attempted to allocate a second instance of a singleton.");
    _instance = [super alloc];
    return _instance;
}
return nil;
}
+ (id)allocWithZone:(NSZone *)zone {
@synchronized([CTEModelManager class]) {
    NSAssert(_instance == nil, @"Attempted to allocate a second instance of a singleton.");
    _instance= [super allocWithZone:zone];
    return _instance; // assignment and return on first allocation
}
return nil; //on subsequent allocation attempts return nil
}
- (id)init {
self = [super init];
if (self != nil) {
}
return self;
}
- (id)copyWithZone:(NSZone *)zone {
return self;
}
 
     
    