Generate Objective-C Singleton
@implementation <#MyManager#>
#pragma mark Singleton Methods
+ (id)sharedManager {
static <#MyManager#> *sharedManager = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{Generate Objective-C Singleton
@implementation <#MyManager#>
#pragma mark Singleton Methods
+ (id)sharedManager {
static <#MyManager#> *sharedManager = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{Generate a Bearer token to access Twitter REST API
- (void) generateAPIKeyWithCompletionBlock:(void (^)(BOOL success, NSString* twitterOAuthToken, NSString *error))completion {
//Network tasks should be in background thread
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
//Generate Bearer Token according to Twitter Documentation
NSString* bearerToken = [NSString stringWithFormat:@"%@:%@", TWITTER_API_KEY , TWITTER_API_SECRET];
bearerToken = [[bearerToken dataUsingEncoding:NSUTF8StringEncoding] base64EncodedStringWithOptions:0];#Register for remote notifications in Objective-C
if ([application
respondsToSelector:@selector(registerUserNotificationSettings:)]) {
UIUserNotificationSettings *notificationSettings = [UIUserNotificationSettings settingsForTypes:
UIUserNotificationTypeAlert |
UIUserNotificationTypeBadge |
UIUserNotificationTypeSound categories:nil];| export CLICOLOR=1 | |
| export LSCOLORS=GxFxCxDxBxegedabagaced | |
| export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ " | |
| alias sub='sublime' | |
| alias ll='ls -la' |
#Registering
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//Your code...
//Check if OS is Version 7
if (![[UIApplication sharedApplication]
respondsToSelector:@selector(registerUserNotificationSettings:)]) {#Visual Debuging#
If you are borred to use po myObject to check the content of your objects, you may use debugQuickLookObject, an XCode hidden gem.
Assuming your object is a subclass of NSObject
- (id)debugQuickLookObject {
UIImage* img = [UIImage imageNamed:self.productThumbImage];
UIImageView* view = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, img.size.width, img.size.height)];
view.image = img;| public extension UIDevice { | |
| var modelName: String { | |
| #if (arch(i386) || arch(x86_64)) && os(iOS) | |
| let DEVICE_IS_SIMULATOR = true | |
| #else | |
| let DEVICE_IS_SIMULATOR = false | |
| #endif | |
| var machineString : String = "" |
| // | |
| // CoreDataController.swift | |
| // | |
| // | |
| // Created by Célian MOUTAFIS on 26/04/2016. | |
| // Copyright © 2016 mouce. All rights reserved. | |
| // | |
| import Foundation |
| // | |
| // SuperViewController.swift | |
| // Mouce | |
| // | |
| // Created by Célian MOUTAFIS on 15/06/2016. | |
| // Copyright © 2016 Célian MOUTAFIS. All rights reserved. | |
| // | |
| import Foundation | |
| import UIKit |