Posts

Showing posts from 2019

How to remove cocoapods from project iOS swift? || xcode remove pods from project

Image
Solution: 1. Open the terminal app from applications. 2. Goto the project path in terminal.Just drag and drop the project folder to terminal 3. In terminal use the code be like. cd yourprojectfolderpath After that execute the below code step by step to deintegrate the cocoapods in your project.             $s udo g em i nstall c ocoapods- d eintegrate cocoapods- c lean             $p od d eintegrate             $p od c lean              $r m P odfile

Update the cocoapods in MACOS

Solution: Goto terminal and use the below command to update the cocoapods in macOS. sudo gem install cocoapods

How to update Xcode on OSX version in mac?

Solution: You can easily update the xcode version in mac. Goto applications in MAC or otherwise it will be placed on desktop doc panel. Click the top right corner updates button. It will show you the updates available for mac. Find the xcode on the list and select update.XCode will be updated.

Xcode error. Could not find developer disk image when try to run to iPhone

Solution: If your device contains latest os version and your xcode is old then the above error will be occurs. Download the latest xcode version and install it and run it. Right click on your xcode in applications and select show package contents -> Content ->Developer ->Platform ->iphoneOS.Platform ->Device support .If it will contains the folder with your phone os version then only it will works.Download and install to happy coding.....

Develop iOS apps in windows machine

Solution: It is definitely possible but you must have high configuration machine with you. First you have to install wine app in your windows machine. After that you must install the macOS inside your wine.Then install xcode on mac after that you can easily develop the iOS apps.

How to disable the tableView selection in iOS swift

Solution: You can disable the did select option in tableView iOS swift.             myTable.allowsSelection = false It will disable selection for entire tableView.Didselect delegate method never works when added the above code.Inside the cell if you had any buttons then the action will work.But cell selection tableView only not work.

Image icons for iOS

Solution: If you are using common images then you can easily download in the web.Use the below link. https://material.io/resources/icons/?style=baseline Use search to search the icon.If you want filled,outlined or rounded select based on your requirement. Click select icon In dropdown select iOS and select white or empty background and download. extract the zip file and it will show you 18,24,32,48 icons.Drag on that and drop into your assets folder then use it in your app.

iOS huge image load issue lagging

Solution: If you are downloading huge amount of images and display in your view then don't load the view in for loop based on the count. Must use the tableView to load the images.So it will be smoothly loading.Cells are reused so memory issue also solved. Note: If you are using if loop inside cell loading then it must be having else loop.Like if you are setting one image in if loop then must use else loop to set the alternative image.Otherwise it will show you wrong images.

How to avoid null pointer exception in swift iOS

Solution: If you are getting the value from server or if you don't know the type of data type then use the below code. The below code is used for get the string value.If the datatype is string then only inside of the code executes.So if the value came as nil then no issues we can handle.         if let nameString = namStr as ? String {             //use the nameString         }

iOS superView navigation button actions wants to be disable when adding popoverController

Solution: 1. When presenting or adding one subview then hide the navigation bar before presenting the view. 2. After completion of all steps when calling the delegate method to the superView then visible the navigation bar is a better option for that.

iOS UITextfield disable editing for typing swift

Solution: 1. Set the textfield inputview to UIView and set the user interaction to be enabled. 2. If you set the user interaction disabled you cannot be able to change the text as bold font style and change the background color.         myTxtField . inputView = UIView () If you want to change that to disable then use the below code          myTxtField .inputView = nil

Download Xcode DMG or XIP file || xcode versions || xcode download

Solution: You can find and download the Xcode dmg file from apple developer website with valid login of apple developer account. https://developer.apple.com/download/more/ Goto the above url and login with the valid userID and download the dmg files. Xcode 11.3 https://developer.apple.com/services-account/download?path=/Developer_Tools/Xcode_11.3/Xcode_11.3.xip Xcode 11.2.1 https://developer.apple.com/services-account/download?path=/Developer_Tools/Xcode_11.2.1/Xcode_11.2.1.xip Xcode 11.1 https://developer.apple.com/services-account/download?path=/Developer_Tools/Xcode_11.1/Xcode_11.1.xip Xcode 11 https://developer.apple.com/services-account/download?path=/Developer_Tools/Xcode_11/Xcode_11.xip Xcode 10.3 https://developer.apple.com/services-account/download?path=/Developer_Tools/Xcode_10.3/Xcode_10.3.xip Xcode 10.2.1 https://developer.apple.com/services-account/download?path=/Developer_Tools/Xcode_10.2.1/Xcode_10.2.1.xip Xcode 10.1 https://devel

Add existing framework in Xcode 4

Image
Solution: 1.In left side of  your Xcode project navigator select you project after that select your target 2.select the build phases tab. 3.Expand link binaries with libraries. 4.Click + and select that you want to add that had been downloaded.

Xcode find not working for shuffle or search to top

Solution: In Xcode search option called Find -> Text -> containing or  Find -> Text -> Matching use containing option for better  sub keyword results. Containing will show you like if your keyword is "view" then it will find and show "viewcontroller" also.But matching only show the particular key.

Split the string based on space iOS swift || Split string and save in an array iOS swift

Solution: We can easily split the string value based on space and save it into an array using the split function like below   In swift:         var namStr = "First Middle last"         var nameArr = s plit(namStr) {$0 == " " }         nameArr[0]// First         nameArr[1]// Middle         nameArr[2]// last In swift 2:          var  namStr =  "First Middle last"         let nameArrVal = namStr. c haracters . split {$0 == " " }. map ( String . i nit )

this class is not key value coding-compliant for the key string iOS exception swift

Error: [<UIViewController 0x3927310> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key string.' Solution: 1. If your storyboard Viewcontroller contains wrong class name then the error will came. 2. If you had wrong outlet connections in your class then the error occurs 3.If your class filename not selected for target membership it will came

Swift for loop and for index element in an array iOS

Solution:   The below code is used for looping with index and value from one array. arr is an array with set of values i - index value - data at particular index         var a rr = NSMutableArray ()         for (i,value) in arr. enumerated (){             print ( "index value =" ,i)             print ( "data value =" ,value)         }

How to set the html string to the textView iOS swift

Solution: You can easily get the html string and set that to textview.In textview it had an option called attributed text to set the string with attributes like bold ,italic ,underline etc .. The below code is used for set the html properties based text to the textView Code: import UIKit class ViewController: UIViewController {     @IBOutlet weak var myTxtView: UITextView !     override func viewDidLoad() {         super . viewDidLoad ()         var h tml =  "<b><i>text</i></b>"         myTxtView . attributedText = html. htmlToAttrString         // Do any additional setup after loading the view, typically from a nib.     }     override func didReceiveMemoryWarning() {         super . didReceiveMemoryWarning ()         // Dispose of any resources that can be recreated.     } } extension String {     var htmlToAttrString: NSAttributedString ? {         guard let data

Remove trailing zero's from Double swift iOS

Solution: If you had an output that contains 0.1 it will return 0.1.If it was 1.0 it will return 1.If it was 1.1 it return 1.1 func forTrailingZero(temp: Double) -> String {     var roundDouble = String(format: "%g", temp)     return roundDouble } Function Call: Var doub = 3.0 forTrailingZero(doub)   //3

Vertically align text to top iOS UILabel

Solution: You cannot be able to align the label vertically.At the same time you can be able to set the number of line in UILabel.If you set that number of lines only if you want constantly particular number of lines. For example if you want that label will display only 2 lines then set the number of lines to 2. Otherwise you have to set that number of lines equal to 0 and call sizetofit. myLabel.numberOfLines = 0 myLabel.sizeToFit()

Xcode 11 creating project don't had storyboard and also swift file had different

Solution: In xcode 11 it had two different options available for app creation. 1.swiftUI framework 2.Storyboard framework By default swiftUI is selected.If you want storyboard based you must have to select that on the time of project creation.

Xcode 11 simulator hangs when type in textField inside app

Solution: Yes this issue is happening in xcode 11.If it occurs you must have to quit the simulator and run it again will be solved.Don't wait for recoverance. It's an xcode bug not your app issue.

Change the image background Color to white

Solution: If you don't know the photoshop then don't worry.Follow the below steps to change the backgroud color to white to your image. 1. First open the site link below https://www.imgonline.com.ua/eng/replace-white-background-with-transparent.php In that site scroll down and find that choose file option. Click on that it will get your file from your computer. Click the ok button below to convert your uploaded image background color to white. Finally click the download to download your converted image..Enjoyyyy...

iOS swipe down to close for popupview || iOS latest feature

Solution: In iOS 13 there is a huge option that will popover one view to another and swipe down the view to close. We can see how to achieve that. Code:              let  anotherView =  self . storyboard ?. instantiateVi ewController (withIdentifier:  " anotherView " )              if   #available ( iOS   13.0 , *) {                 anotherView?. isModalInPresent ation  =  false             }  else  {                  // Fallback on earlier versions             }              self . present (anotherView!, animated:  true , completion:  nil ) The above code is for present the view and swipe down we can close that.

Change background color of an image in MAC

Solution: 1. Open the image using preview in MAC. 2.In top of the menu select preview -> Preference -> General 3.Option shown as window background -> select on that color pallete. 4. Change the colors whatever you want and save.

Extend the width of button using swiftUI.

Solution: struct myButton: ButtonStyle {     func makeBody(configuration: Configuration) -> some View {         configuration.label             .padding()             .frame(minWidth: 0,                    maxWidth: .infinity)             .foregroundColor(.white)             .padding()             .background( RoundedRectangle(cornerRadius: 5.0).fill(Color.orange)         )     } } Use the button be like below. Button(action: { self.isActive = true }) {         Text("Login")            .fontWeight(.bold)     }   .buttonStyle(myButton())

iOS 13 Features

3D touch: It's used for app shortcuts in 3D touch to show functions to the user. Battery: Charging optimisation for long life battery is available on iOS 13.If your iPhone is charged 80% then you can set it as morning alarm for battery charging. Control Center: Without opening the settings you can access the bluetooth and wifi directly. App downloads: App download limit for 200MB is gone in iOS 13.You can enjoy the unlimited app download limit. Files: You can easily zip and unzip the files in the iPhone. You can also create nested folders in the folder app. Keyboard: Finally swipe keyboard is available in iphone.You can enjoy the swiping to type the words like android Phone. Share: Share options are ultimately mass to the user can share within few taps.

iOS app crashed on device.dyld library not loaded

Solution: In general tab there is an embedded binaries tab.In that tab click + button and add the exception told framework to your project .It will resolved the problem

XCode error on simulator MGIsDeviceOneOfType is not supported on this platform

Solution: 1. Goto your target select edit scheme. 2. In left menu select Run 3.In Top menu select arguments. 4. Select + then  OS_ACTIVITY_MODE set the value to be disable. 5.Clean the project and run.It will works good...

XCode 11 simulator not launching issue iOS swift

Image
Solution: If you are freshly install the xcode then you must have to download and install iOS simulators using below steps. 1.Open Xcode 2.On top menu click XCode and select preference. 3.  4.In above menu select components. 5.Download the simulators with iOS that you want.After installation launch the xcode clean the app and run..Simulator will launch quickly

Etsy account rules || ETSY account blocked

If you are want to sell your product online in ETSY you must want to follow some set of conditions. 1. First you must have to create an account in one laptop and internet connection in particular cellular network then in future must be use that same. Otherwise your account will be blocked from their side at a particular set of time.So be careful to use that. Also you cannot have to use others images and products.If your product get blocked it will be blockmark to you and after sometime your account will be blocked.

How to set Two factor authentication with phone number in GMAIL || Gmail phone number SMS verification when try to login

Solution: 1) Login into Gmail and click your profile icon and select google account 2) In left menu select security. 3) In right side select two step verification. 4) It will get your password of your Email and set that to on. 5) After that every time you login into your email it will send you an sms code after you enter that only you can login to your account.

iOS crash when try to load automatic dimention for tableView or CollectionView

Solution: If you are tried that automatic dimention that tableView or Collection View will load the content with automatic height then sometimes this problem occurs. So better you can set the height in constant and run the app it will works good.

Delete trash MAC issue || Empty trash MAC hangs

Solution: If you are deleted the max number of files.It will be trash then if you tried to delete that then MAC will be hanging.Because first it will fetch the item count.If it was large then mac will be getting hanged. Also if you tried to delete the Xcode then empty the trash then definitely mac will be very slow. We had a better solution to solve that. 1. If you had more number of files then delete small set of files and try it in few more times. 2. If it will be Xcode then right click on that and select the option that show package contents and then delete small set of files.You can easily delete all the files within a few times.

Could not attach PID iOS simulator launching error

Solution: When you run your app if it show that could not attach PID error then follow the below steps to solve that. You can understand that it is a cache issue. 1. So first goto derived data and delete all. 2. after that delete the app in the simulator. 3. Goto hardware reset content and settings in simulator. 4.Clean the project in Xcode. 5.Run the app it will works good.

EKRecurrence rule iOS swift

Solution: You can be use ekrecurrence rule for repeating the event scheduling without using for loop. you can also add the alarm to the event. recurrenceWithFrequency - it will be weekly,yearly,monthly,.daily daily schedules with end date or without end date you can add. If you given the monthly and start date it will be generated every month that date.In year every day,month it will be repeatable. interval - it is used for interval of the event. daysOfTheWeek - you can give the day numbers like sun -1,mon -2 daysOfTheMonth - you can give the value between 1-31 or -1 to -31 monthsOfTheYear - You can give the numbers with 1 to 12 end - end date you can give Code: let event = EKEvent(eventStore: self.eventStore) event.title = title event.startDate = fourthOfJulyStartDate event.endDate = fourthOfJulyEndDate event.addRecurrenceRule(EKRecurrenceRule(recurrenceWithFrequency: .Yearly,     interval: 4,     daysOfTheWeek: nil,     daysOfTheMonth: [NSNumber(int: 4

How to disable the tableView selection

Solution: You can disable the selection during the editing the table view using the below code. you can use the below code in the viewdidload tableView.allowsSelection = false

Delete row from tableView or CollectionView crashes

Solution: Before that you have to know that your data array must be delete the value before updating the tableView or collectionView Also number of rows or number of sections will be sometime problem.

UIImageOrientation inn swift 5

Solution: UIImage orientation is changed as below in swift 5 Swift 4: UIImageOrientation swift 5: UIImage . Orientation

NSForegroundColorAttributeName in swift 5

Solution: Swift 4 : NSForegroundColorAttributeName swift 5: NSAttributedString . Key . foregro undColor

UIImagePNGRepresentation in swift 5

Swift 4:   UIImagePNGRepresentation( self )   Swift 5: self . pngData ()

Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (3) must be equal to the number of rows contained in that section before the update (3), plus or minus the number of rows inserted or deleted from that section (0 inserted, 1 deleted).

Problem: Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (3) must be equal to the number of rows contained in that section before the update (3), plus or minus the number of rows inserted or deleted from that section (0 inserted, 1 deleted). If i delete the row and set the datasource then it shows the above exception. Solution: You have to reload the data in the tableView or collectionView will solve the problem.Also before delete the row must have to delete the particular index in your array or dataSource

UIBarButtonItem appearance in swift 4 and swift 5

Solution: Swift 4:          UIBarButtonItem . appearance () . setBackButtonTitlePositionAdj ustment (UIOffsetMake( -200 ,  -5 ), for: . default ) swift 5:          UIBarButtonItem . appearance () . setBackButtonTitlePositionAdj ustment ( UIOffset (horizontal:  -200 , vertical:  -5 ), for: . default )

Font with attributes in swift 4 and swift 5

Solution:          let  attrs = [ NSParagraphStyleAttributeName: style, NSForegroundColorAttributeName : UIColor . white , NSFontAttributeName: UIFont ( name:  "Trebuchet MS" , size:  20 )] swift 5:          let  attrs = [ NSAttributedString . Key . paragr aphStyle : style, NSAttributedString . Key . f oregroundColor : UIColor . white , N SAttributedString . Key . font : UIF ont (name:  "Trebuchet MS" , size:  20 )]

image with name in swift 5 || fetch image by name in iOS

Solution:   In swift 4 we can use the below code to fetch image by name UIImagePNGRepresentation( UIIma ge (named:  "imageName" )!)! Swift 5: return   UIImage (named:  " imageName " )!. pngData ()!

CMTimeRange in swift

Solution:              let   range:   CMTimeRange   =   CMTimeRangeMake (start, end) Swift 5:              let  range:  CMTimeRange  =  CMTimeRangeMake (start: start, duration: end)

CMTimeMakeWithSeconds in swift 5

Solution: CMTimeMakeWithSeconds ( 1.0 ,   600 ) In swift 4 we are used the above code for CMT. Swift 5:              let  start:  CMTime  =  CMTimeMakeWithSeconds ( 1.0 , preferredTimescale:  600 )

AVFileTypeQuickTimeMovie in swift 5

Solution: In swift 4 we can use the below code to represent the movie using the below representation AVFileTypeQuickTimeMovie Swift 5: AVFileType . mov In swift5 use the above code to represent the movie...

UIImageJPEGRepresentation not available in swift 5 || Image to data conversion in swift

Solution: In swift 4 we can use the below code to convert the image to data Swift 4:  UIImageJPEGRepresentation( savingImage, 0.5) swift 5: savingImage. jpegData ( compressionQuality:  0.5 )

UIEdgeInsetsMake in swift 5

Solution: Swift 4: UIEdgeInsetsMake is used in swift 4. Swift 5: UIEdgeInsets (top:  0 , left:  -10 , bottom:  0 , right:  10 ) Use the above code for  UIEdgeInsetsMake

NSAttributedString in swift 5

Solution: swift 4: try NSAttributedString(data: Data(utf8), options: [ NSDocumentTypeDocumentAttribut e: NSHTMLTextDocumentType, NSCharacterEncodingDocumentAtt ribute: String.Encoding.utf8.rawValue] , documentAttributes: nil) swift 5: return   try   NSAttributedString (data:  Data ( utf8 ), options: [ NSAttributedString . DocumentRe adingOptionKey . documentType :  String . Encoding . utf8 . rawValue ] , documentAttributes:  nil )

Install app without DIAWI || Install IPA directly to iPhone || Alternate to DIAWI

Solution: 1) First clean the app using the command shift+command+k 2) After that build the app using the key command command+b 3) You can find your ipa app inside the file directory with your app name.Right click on that and show in finder 4)Paste into one folder.Compress the folder and rename it into appname.ipa 5)Connect your phone to the MAC open xcode goto->Windows->devices and simulators->User that select + then select your app file in that.It will directly installed to your phone. 

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSDictionaryM setObject:forKey:]: object cannot be nil (key: Z8TITLE)'

Solution: If you are tried to set declare the dictionary and then set the values on run time is raised the problem.So if your values will be changable at runtime then must use NSMutableDictionary then assign the values to that.

UICollectionView invalid number of items crash problem and solution || UITableview invalid number of items crash problem and solution || swipecellKit delete issue

Solution: If you are delete the row or section before you must have to delete the value from the array that you had used for the tableView or collectionView. If you are used the swipecellKit must follow the below steps. You have to implement the below delegate method only. func collectionView(_ collectionView: UICollectionView, editActionsForItemAt indexPath: IndexPath, for orientation: SwipeActionsOrientation) -> [SwipeAction]? { } Don't implement the below  function because it will delete the row immediatly so.Bo of rows or number of section issue will be occur func collectionView(_ collectionView: UICollectionView, editActionsOptionsForItemAt indexPath: IndexPath, for orientation: SwipeActionsOrientation) -> SwipeOptions { }

Hide one segment in SegmentControl iOS . swift

Solution: We had two options with that to achieve.First one is 1.Set the width to 0.Disable the segment to that. Objective C: [seg setWidth:0.1 forSegmentAtIndex:1]; [seg setEnabled:NO forSegmentAtIndex:1]; OR  [self.seg removeSegmentAtIndex:0 animated:NO]; Swift:  seg.removeSegment(at: 0, animated: false) 2. Remove the index from the segment Control

How to create target with same app and different Name iOS swift || create target in swift

Solution: 1.First select the the app it will show you all the targets 2. In that target select the app you want to duplicate 3.right click on that it will show you 2 options.delete and duplicate. 4.Select duplicate it will show you the target with same name copy.It will also creates different plist for the duplicate app

How to get a key value from info.plist iOS swift

Solution:   func AppkeyPath() -> ( NSString ) {         return Bundle . main . object (forInfoDictionaryKey: "keyName" ) as ! NSString     } Add the above function to your utils and add the " keyName " in your info.plist

Dynamic height of cell based on user typing the text iOS swift || textview dynamic height iOS

Solution: If you wants to adjust the height based on your textview text then below the steps will be easy to achieve that, Also if you are using tableview also easy to do that.Using autolayout for wrap content like in android. first you have to set the constraints to the textview without height because height will be adjustable.Except height you can give all the constraints then in tableview delegate methods must implement that row height will be autodimention. after that you can enjoy with the dynamic height tableview

Google drive google docs not able to paste the image it shows esclamatory symbol

Solution: If you are copy the image from one drive to another then it shows like that. MAC: So if you are using the mac system then download your file as docx format to your system and open it via pages app. After that copy the image from drive paste it in your file in pages then upload it into your google drive. Then it will works. WINDOWS: So if you are using the windows system then download your file as docx format to your system and open it via microsoft word app. After that copy the image from drive paste it in your file in pages then upload it into your google drive. Then it will works.

UITextField with underline iOS swift

Solution: If you had a textField that wants to be underlined follow the below steps you can achieve. 1. First you have to choose your textfield as custom in your storyboard. 2. Then add an extension to textfield 3. Then assign the delegate to the textfield.call your custom function and then enjoy with the underline. Coding: // MARK: uitextField extension UITextField {     func underlined(){         let border = CALayer ()         let lineWidth = CGFloat ( 0.3 )         border. borderColor = UIColor . darkGray . cgColor         border. frame = CGRect (x: 0 , y: self . frame . size . height - lineWidth, width:   self . frame . size . width , height: self . frame . size . height )         border. borderWidth = lineWidth         self . layer . addSublayer (border)         self . layer . masksToBounds = true     } } import UIKit class  ViewController: UIViewController , UITextFieldDelegate {      overri

Sort an NSMutablearray with custom objects in iOS

Solution: You can use sortdescriptor to sort an array of objects. NSSortDescriptor *sortDesc; sortDesc = [[NSSortDescriptor alloc] initWithKey:@"createdDate"                                            ascending:YES]; NSArray *sortArr = [arrayDetails sortedArrayUsingDescriptors:@[sortDesc]];

right gesture tap action tableview iOS swift || Get the action for swipe close in uitableview

Solution: If you want to call some set of codes after the swipe action user had tapped on the screen and swipe options close use the below code.     func tableView( _ tableView: UITableView , didEndEditingRowAt indexPath: IndexPath ?) { //inside code to handle the tap after swipe }

iOS tableView cell loading incorrectly with empty space swift

Solution: If you had any changes in the cell and reloaded the particular section or particular row then it will have some set of issues. So better you can use the tableview reloaddata function to solve this.

iOS latest Interview Questions

1) Difference between cocoa and cocoa touch ? Both are used for developing apps in OSX and iOS Cocoa had foundation and appkit frameworks.Cocoa Touch had UIKit and foundation frameworks 2)Which json framework supported by iOS? SBJSON is supported by iOS 

When click the notification generated from my app crashes and goback to appdelegate iOS swift

Solution: If it went back to appdelegate then just watch the log that produced.If it had any array issues then put the breakpoint and goto step by step and solve it. First you have to check with didfinishLaunching method in app delegate.Then check with notification delegate methods.After that you cannot find then check with didenterforeground and didenterbackground methods in appdelegate.It's easy after that you can solve.

Disable the screen Lock when audio recording iOS

Solution: If you are recording the audio when your app is on use and don't had any actions performed only recording will happen then if your screen lock time is some seconds that time screen will be locked. So try the below code code to disable the screen lock when audio is recording.When audio record started the call the below code. Objective C: [UIApplication sharedApplication].idleTimerDisabled = YES; Swift:   UIApplication . shared . isIdleTimerDisabled = true In didfinishrecording call the below code Objective C: [UIApplication sharedApplication].idleTimerDisabled = No; Swift:   UIApplication . shared . isIdleTimerDisabled  =  false

Remove the lines below the empty tableView iOS swift and objective C

Solution: If you want to remove the empty cell spaces below the code then use the code to remove the lines in the empty tableView Swift 5:     override func viewDidLoad() {         super.viewDidLoad()         mytblView.tableFooterView = UIView()     } Objective C: - (void) viewDidLoad {   [super viewDidLoad];   self. mytblView.tableFooterView = [UIView new]; }

Insert the indexpath row in iOS swift and Objective C

Solution: If you want to add the index in the row without reloading the entire tableView then use the below code. Swift: tableView.beginUpdates() tableView.insertRows(at: [IndexPath(row: yourArray.count-1, section: 0)], with: .fade) tableView.endUpdates() Objective C: [self. tableView beginUpdates]; NSArray *arr = [NSArray arrayWithObject:[NSIndexPath indexPathForRow:Yourarray.count-1 inSection:0]]; [self. tableView insertRowsAtIndexPaths:arr withRowAnimation:UITableViewRowAnimationAutomatic]; [self. tableView endUpdates];

Move the images or files from one folder to document directory iOS swift

Solution: The below solution is used for move the entire folder data to the document directory. You can move the entire folder data except text files from that folder is like below.     // #MARK: - move the zip folder files to document directory          func movefilestoDocument(folderPath: String ){         let documentsPath = URL(fileURLWithPath: NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true )[ 0 ])         let path = URL(fileURLWithPath: folderPath)                  do {             // Get the directory contents urls (including subfolders urls)             let directoryContents = try FileManager.default.contentsOfDirectory(at: path, includingPropertiesForKeys: nil )             print(directoryContents)             // if you want to filter the directory contents you can do like this:             let directoryFiles = directoryContents.filter{ $0.pathExtension != "txt" }             for i in 0 .

Vetically align text to top iOS swift

Solution: It was not possible to align the text in center.But you can set the text to be center in the label. You can also set the text to be in horizondally center in the label. You can use the sizetofit and nooflines to set the label height with adjustable for lines also.

Button click not working iOS swift

Solution: I had the cell that contains one view with some set of elements and one button.I had added an action for the button.But if o click the button it was not working. After that i had checked that in storyboard the button is in the below of the view so it was not worked.So i get the button to front in the view and click that it was worked.....

iOS upload app issue

Solution: When i try to upload my app in app store not able to upload it shows an error that no bundle identifier found. So i tried that if that account has the permission from the admin for that app.So you have to check that itunesconnect website to get the app is listed in the account.

Swift 5 conversion in iOS xcode project

Image
Solution: In your Xcode if you open the project in warning tab you can see the below status But if you tried with that way it will convert your project to swift 5 but it will show more unresolvable errors. So better you can create a new project and add the old project files in step by step and resolve the syntax issues will be the best solution for this.If you can do this way you can save more time on migration.

undefined symbol sqlite3_column_table_name error in iOS swift

Solution: When your project does not added the sqlite framework then the above error will came.So try to add the framework in your project and compile it will works.

Git error no file found for particular path but the file had already exist

Solution: If you are the file within the folder and that foldername contains space then remove the space and commit it will works good.

activityIndicator in swift 5

Solution: The below code is used for activity indicator in swift 4              let  activityIndicator = UIActivityIndicatorView( activityIndicatorStyle: . white ) In swift 5 the below code is used. let  activityIndicator =  UIActivityIndicatorView (style: . white )

String functions in swift 5

Solution: In swift 4 the below code is used for capitalise the first letter. String(characters.prefix(1)). capitalized In swift 5 below code is used for capitalise the first letter. let  first =  String ( prefix ( 1 )). capitalized             

How to get string characters count in swift 5

Solution: In swift 4 we are using the below code to find the characters in a particular string charactrers.count In swift 5 we are using the below code string.count

UIEdgeInsetsInsetRect not working in swift 5

Solution:  The below code is used in swift 4.In swift 5 it shows as error. Swift 4: UIEdgeInsetsInsetRect( relativeFrame, self.touchAreaEdgeInsets) swift 5: relativeFrame. inset (by:  self . touchAreaEdgeInsets ) Relative frame is known as the frame that you want to set the edges.