Touch ID Authenticate

LAContext *context = [[LAContext alloc] init]; NSError *error = nil; if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]) { [context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:@”Login with Touch ID” reply:^(BOOL success, NSError *error) { if (error) { UIAlertView *Alert = [[UIAlertView alloc] initWithTitle:@”Login” message:@”Login Fail” delegate:self cancelButtonTitle:@”Close” otherButtonTitles:nil, nil]; [Alert show];                                  } if …

SetBadge on UITabBarController

Make Extension of UITabBarController extension UITabBarController {          func setBadges(badgeValues: [Int]) {                  for view in self.tabBar.subviews {             if view is CustomTabBadge {                 view.removeFromSuperview()             }         }                  for index in 0…badgeValues.count-1 {             if badgeValues[index] …

Remove emoji from text field/text view

set keyboard type to UIKeyboardTypeASCIICapable (txtField.keyboardType=UIKeyboardTypeASCIICapable;) you can find swift code from below link – (BOOL)stringContainsEmoji:(NSString *)string { __block BOOL returnValue = NO; [string enumerateSubstringsInRange:NSMakeRange(0, [string length]) options:NSStringEnumerationByComposedCharacterSequences usingBlock: ^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) { const unichar hs = [substring characterAtIndex:0]; // …

Push notification using firebase

Never Forget to define your REVERSED_CLIENT_ID (provided in GoogleService info.plist file) to your project target ->Info->URLschema . //Add your APNS certificate in the application created in Firebase. func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {         let settings = UIUserNotificationSettings(types: …

Date to String and String to Date with Time Zone

// Methods to get string from date public func setStringfromDate(date : Date, dateFormate : String, timezone : TimeZone) -> String {     let dateFormatter = DateFormatter()     dateFormatter.timeZone = timezone     dateFormatter.dateFormat = dateFormate     return dateFormatter.string(from: date) } // MARK: –  String to Date …