Stack Implementation in swift

public struct Stack{ private var array:[T] public var maxSize:Int? public init(){     array = [] } //MARK: isEmpty public var isEmpty:Bool{ return array.count == 0 } //MARK: count public var count:Int{ return array.count } //MARK: PUSH public mutating func push(element:T){ if (maxSize != nil){ if array.count >= maxSize{ print("OverFlow") } } array.append(element) } //MARK:... Continue Reading →


Queue implementation in swift

public struct Queue<T>{     private var array:[T]     public init(){         array = []     }     //MARK: isEmpty     public var isEmpty:Bool{         return array.count == 0     }     //MARK: count     public var count:Int{        ... Continue Reading →

UIApplication and its Delegate

1. UIApplication :  root class UIResponder A major role of your app’s application object is to handle the initial routing of incoming user events he application object maintains a list of open windows (UIWindow objects) and through those can retrieve any of the app’s UIView objects The UIApplication class defines a delegate that conforms to... Continue Reading →

FitBit AOuth in iOS app

The Fitbit API allows developers to interact with Fitbit data in their own applications, products and services. The API allows for most of the read and write methods that you will need to support your application. If you have uses or needs that are not currently supported by the API, drop by the Dev Forum... Continue Reading →

Making a class singleton in Swift

Making a class singleton  in Swift Create a singleton class import UIKit import AVFoundation class TextToSpeech: NSObject {         let speechSyn=AVSpeechSynthesizer()     var speechUlt=AVSpeechUtterance(string: "")               class var shareInstance:TextToSpeech{       struct Static{         static var onceToken:dispatch_once_t=0         static... Continue Reading →

Block as a completion Handler in iOS

Block as a completion Handler in iOS In Objective-c declare a méthode:: -(void) getCallBack:(NSString *)string1 onCompletion:(void(^)(NSString *sting))handeler; function implementation: -(void) getCallBack:(NSString *)string1 onCompletion:(void(^)(NSString *sting))handeler{          handeler(string1); } function calling: [self  getCallBack:@"Sunny" onCompletion:^(NSString *value){         NSLog(@"My name is %@",value);     }]; In Swift function declaration:: func getValueByMultiPle(value1:Int,value2:Int,onCompletion:((success:Int)->Void),onError:((errorValue:String)->Void)){     ... Continue Reading →

Common method in Swift

1. Check for any field empty in NSDictionary class func checkforEmptyValueinDictioanty(dic:NSDictionary)-> Bool{ for (keyVal, dataVal) in dic {   if (dataVal.length()==0){                 println("\(keyVal): \(dataVal.length())")                 return false             }                 ... Continue Reading →

Create a free website or blog at

Up ↑

%d bloggers like this: