Skip to content

Instantly share code, notes, and snippets.

@fahadjamal
fahadjamal / ArrayManager.swift
Created February 23, 2017 06:22
Getting Device Token for Push Notification Singletion Class
import UIKit
class ArrayManager: NSObject {
static var singletonObjectObj : ArrayManager!
class func sharedInstance() -> ArrayManager {
guard (singletonObjectObj != nil) else {
singletonObjectObj = ArrayManager()
return singletonObjectObj
@fahadjamal
fahadjamal / AppDelegate.h
Created February 23, 2017 06:18
Notification about updating Enterprise App
// In App Delegate Add this
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
let updateManager : UpdateManager = UpdateManager.sharedManager()
updateManager.pListUrl = String(format: "%@", GlobalConstants.AppDownloadPlistURL) // GlobalConstants.AppDownloadPlistURL
updateManager.versionUrl = String(format: "%@", GlobalConstants.AppVersionURL) //
updateManager.checkForUpdates()
}
@fahadjamal
fahadjamal / SynthesizeSingleton.h
Created February 23, 2017 06:00
Login Modal for keeping your User Login data inside your App
#define SYNTHESIZE_SINGLETON_FOR_CLASS(classname) \
\
+ (id)allocWithZone:(NSZone *)zone \
{ \
@synchronized(self) \
{ \
if (shared##classname == nil) \
{ \
shared##classname = [super allocWithZone:zone]; \
return shared##classname; \