Step 1 : Create project on facebook developer page and get facebook app id Step 2 : Insert following gradle file and sync your project compile ‘com.facebook.android:facebook-android-sdk:4.5.0’ Step 3 : Put your facebook app id in string resources as given below <string name=”facebook_app_id”>1763757463948957</string> Step 4 …
3D Touch
– (void)viewDidLoad { [self registerForPreviewingWithDelegate:self sourceView:MyView]; } #pragma mark UIViewControllerPreviewingDelegate – (UIViewController*)previewingContext:(id<UIViewControllerPreviewing>)previewingContext viewControllerForLocation:(CGPoint)location { UIView *ViewTouch = previewingContext.sourceView; UIViewController *ViewNew = [self.storyboard instantiateViewControllerWithIdentifier:@”demo1″]; return ViewNew; } – (void)previewingContext:(id<UIViewControllerPreviewing>)previewingContext commitViewController:(UIViewController *)viewControllerToCommit { [self.navigationController pushViewController:viewControllerToCommit animated:YES]; }
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] …
Integrate Redis cache mechanism to make website performance faster
If there is API which needs to call again and again. To call API many times will make the website performance very slow. We can use Redis cache mechanism to make website performance faster. Why Redis? It’s a “NoSQL” key-value data store. More precisely, it …
Getting error while adding APNS certificate to Firebase
To overcome this issue while creating an app on Firebase select proper bundle identifier, if you are using com.inheritx.pushnotification for creating apple push notification certificate than writing com.inheritx.pushnotification while configuring an application on Firebase bundle identifier.
UILable Extension for Dynamic Lable font
extension UILabel { func fitFontForSize(var minFontSize : CGFloat = 15.0, var maxFontSize : CGFloat = 300.0, accuracy : CGFloat = 1.0) { assert(maxFontSize > minFontSize) layoutIfNeeded() // Can be removed at your own discretion let constrainedSize = bounds.size while maxFontSize – minFontSize > accuracy { …
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 …