This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Here You can able to fill the 6k contacts to iPhone default AddressBook. | |
Its for testing purpose only I created this API. | |
6000 contacts: 1000 (Steve), 1000 (Tim), 1000 (Kalam), 1000 (Jonathan), 1000 (Vishal), (1000) (Zippr) | |
*/ | |
- (void)dummyContactsFill { | |
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ | |
ABAddressBookRef iPhoneAddressBook = ABAddressBookCreate(); | |
for(int i=0;i<6000;i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)pr_hideEmptySeparators { | |
UIView *emptyView = [[UIView alloc] initWithFrame:CGRectZero]; | |
emptyView.backgroundColor = [UIColor clearColor]; | |
[self.tableView setTableFooterView:emptyView]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSArray *array = @[@(1),@(2),@(3)]; | |
NSInteger index = [array indexOfObject:@(4)]; | |
/** @abstract: we can’t compare the index and also we can’t able to check whether it is a nil value or not? | |
Coz, its a Long Long integer. if you print the index on debugger window, you will get this value: 9223372036854775807 | |
Thats why we are checking with NSNotFound | |
If you don't don the defence check you will crash. Its safety check!. | |
*/ | |
if(index == NSNotFound) { | |
// index value is not found ! | |
// Use the NSAssert for handling the value or !value here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)addConstraints { | |
[self.view removeConstraints:self.view.constraints]; | |
NSDictionary *views = NSDictionaryOfVariableBindings(_contactImageProperty,_peopleAllowLabelProperty,_shareCodesDefaultMessageLabelProperty,_continueBtnProperty); | |
_contactImageProperty.translatesAutoresizingMaskIntoConstraints = NO; | |
_peopleAllowLabelProperty.translatesAutoresizingMaskIntoConstraints = NO; | |
_shareCodesDefaultMessageLabelProperty.translatesAutoresizingMaskIntoConstraints = NO; | |
_continueBtnProperty.translatesAutoresizingMaskIntoConstraints = NO; | |
// contactImageProperty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2015-10-15 14:12:40.898 Contacts[47206:5612488] -[__NSTaggedDate UTF8String]: unrecognized selector sent to instance 0xe41bbcf9e80c4dd3 | |
(lldb) po string | |
2015-10-15 08:42:40 +0000 | |
(lldb) po [string isKindOfClass:[NSString class]] | |
false | |
2015-10-15 15:01:53.762 Contacts[47206:5612488] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSTaggedDate UTF8String]: unrecognized selector sent to instance 0xe41bbcf9e80c4dd3' | |
*** First throw call stack: | |
( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*-------------Initialize Struct class using Generics and bounding for b->child1,child2-----*/ | |
struct b<T> { | |
var resp: T? | |
var meta: metaResp? | |
init?(input:Dictionary<String,Any>,resp: T) { | |
self.resp = resp | |
let bin:[String:Any] = input["base"] as! [String : Any] | |
meta = metaResp.init(input: bin["meta"] as! Dictionary<String, Any>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import UIKit | |
import PlaygroundSupport | |
class InputScene : UIViewController { | |
var emailTxtField:UITextField? | |
var passwordTxtField:UITextField? | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Created - Ranjit | |
import Foundation | |
//: ### Subscript Solution | |
//: We create a special subscript for nested `[String:Any]` dictionaries that also has a getter: | |
extension Dictionary { | |
subscript(jsonDict key: Key) -> [String:Any]? { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension String { | |
public func isPhone()->Bool { | |
if self.isAllDigits() == true { | |
let phoneRegex = "[235689][0-9]{6}([0-9]{3})?" | |
let predicate = NSPredicate(format: "SELF MATCHES %@", phoneRegex) | |
return predicate.evaluate(with: self) | |
}else { | |
return false | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
protocol OTPInputViewProtocol:class { | |
func digitsInputViewCompletion() | |
} | |
fileprivate let MAX_COUNT_DOWN_TIME:Int = 120 | |
class ADOTPInputView: UIView,UITextFieldDelegate { | |
OlderNewer