Posts

NSUserdefault creating multiple file in Preferences folder iOS swift

Solution:  In userdefaults you have to save the small amount of data.If you want to handle large amount of data you have to move to coreData model. Because the app storage size will increase when you save all the data in userdefaults.Then finally the app will crash.Also the OS will kill your app when large amount of storage used.

Build Not visible in iTunes connect after uploading successfully iOS Swift

Solution: If your build had some issues with appicon and launchScreen it will show error during upload to itunesConect. So before upload you must have to check the apicon and Launchscreen. In Appicon must have to check that 1024*1024 icon is exists or not. Also In info.plist file must have to add the user permissions you had already with messages otherwise it will show the same problem also.Like microphone usage,LocationUsage and others....

Passing data between ViewControllers iOS swift

Solution 1: In iOS it's easy to send a data from one view controller to other.If you navigate to the other view controller in that time you want to send a data to the viewController then declare a variable in the next view controller with any Data type like NSMutablearray,String,Int,Double or etc... In the navigation time set the data to that variable like below and navigate let secondController = self.storyboard?.instantiateViewControllerWithIdentifier("ViewController") as LoginViewController secondController.array = self.array self.navigationController?.pushViewController(secondController , animated: true) In secondViewcontroller declare the array variable before the class implementation var array :NSMutableArray! Class LoginViewController:UIViewController { } Solution 2: In other method you can save the data in the userdefaults and synchronize and get that in other ViewController

Swipe gesture for all direction iOS swift

Solution: In iOS you can add a gesture to a particular view in all  4 directions left,right,top and bottom. override func viewDidLoad() {     super.viewDidLoad()     var rightAction= UISwipeGestureRecognizer(target: self, action: "respondSwipe:")     rightAction.direction = UISwipeGestureRecognizerDirection.Right     self.view.addGestureRecognizer(rightAction)     var downAction= UISwipeGestureRecognizer(target: self, action: "respondSwipe:")    downAction.direction = UISwipeGestureRecognizerDirection.Down     self.view.addGestureRecognizer(downAction)     var leftAction= UISwipeGestureRecognizer(target: self, action: "respondSwipe:")    leftAction.direction = UISwipeGestureRecognizerDirection.Left     self.view.addGestureRecognizer(leftAction)     var upAction= UISwipeGestureRecognizer(target: self, action: "respondSwipe:")    upAction.dir...

Right swipe in iOS swift like email app

Solution: Before iOS 11 no methods for right swipe.So you can handle it by using swipe gesture with right swipe.And handle in a method.like below for a table View cell     var swipeRight = UISwipeGestureRecognizer(target: self, action: "rightSwipeGesture:")     swipeRight.direction = UISwipeGestureRecognizerDirection.Right     cell.addGestureRecognizer(swipeRight) The method will be like below func rightSwipeGesture(gesture: UIGestureRecognizer) { } But in iOS 11 below method used for right swipe func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {         let swipeAction = self.contextualDeleteAction(forRowAtIndexPath: indexPath)         let swipeConfig = UISwipeActionsConfiguration(actions: [swipeAction ])         return swipeConfig     } If you want the above meth...

Failed to extract git version from "git -- version" iOS swift error in terminal

Solution: If you are installed new version of Xcode then it will came in command line because in command line tools was not set for xcode. So open your xcode and goto top menu Xcode ->Preference then select Locations below that in command line tools select the current xcode version you use. After that goto terminal then enter "pod init" it will works fine

UserDefaults as common for entire app iOS swift

Solution : In iOS it was easy to create a User default variable as common and get that in entire app. First you have to declare a variable with any name of datatype Userdefaults in Appdelegate funcation at the top. Then in didfinishlaunching initialize the variable and then use it in the entire app.