Posts

DayView hide date in CalenderKit

 Problem: I had installed Calendarkit in my app with pod.I'm using dayview header.I want to hide the top date display line.I want only the view view to be show.How can i achieve that? Solution:      @IBOutlet   weak   var   weekView :   DayView !          var  header =  DayHeaderStyle ()         header. swipeLabel . textColor  = . clear         header. daySelector . selectedBac kgroundColor  =  UIColor (). appTextColor ()           weekView . dayHeaderView . updateS tyle (header) You can update the header style as like above to hide the date display on the top header.

Launch screen came as empty black screen in iOS app

Image
 Problem: I had implemented launch screen with my app.But it's not showing instead of it's showing black screen. I want to solve that. Solution:  Add key  UILaunchStoryboardName in info.plist  The storyboard name as LaunchScreen.Clean the app and derived data and run the app.It will works fine. 

NSNumber predicate in iOS swift

 Problem: I want to filter NsNumber entries in core data. So i tried to use predicate with %@ but it crashes the app. How to solve that? Solution:                          let  datePredicate =  NSPredicate ( format :  "date.integerValue <= %@" , selectedDate )                          let  filtered = dataArray. filtered ( using : datePredicate) It will works fine 

applicationdidbecomeactive not called iOS swift

 Problem: I want to remove the badge number to 0 while launch.I tried in applicationdidbecomeactive method.But it was not called in my app while launch. Solution:      func   sceneWillEnterForeground ( _  scene:  UIScene ) {           DispatchQueue. main . asyncAfter ( deadline : . now () +   0.1 ) {                               UIApplication . shared . applicati onIconBadgeNumber  =  0         }     } In scene delegate class you have to call the above function and you can achieve that.

file provider storage iphone not read in device but simulator works fine iOS swift

Problem: I'm using filemanger to fetch the pdf file and save to document directory.I had tried in simulator it was working fine.In device it was not working.It returns data with nil value.Path will be as like below.  Solution:   /private/var/mobile/ Containers/Shared/AppGroup/some code /67225671.pdf After you fetch the pdf from file manager add the line below              url. startAccessingSecuritySc opedResource () Then only it will works fine in the device.

Navigation bar topitem add right bar button item not shown iOS swift

 Problem: I want to add condition that sometime right bar button item shown and sometime it will not to be shown.That condition all time no button came.But i added item.My code as like below.          if   i == 0  {              self . navBar . topItem ?. rightBarB uttonItems  = [ saveButton ]         }  Solution: The above code have a problem that you cannot initialise and assigned right bar button item.First you have to assign right bar button item and then add it.It will works.Change the code as like below.          self . navBar . topItem ?. rightBa rButtonItems  = []          if   i == 0  {              self . navBar . topItem ?. rightBarB uttonItems  = [ saveButton ]         } 

coredata object mutablecopy in swift

 Problem: I want to copy my coredata object as another object and then change the current object with new updates.After that i want to save or discra the changes.If i save the change then want to know the old object before changed. How can i get that? Solution: You have to add the extension function as below to your coredata entity. func   copyObject () ->   Obj   {           var   newObj =   Obj ( context :   getContext ())           var   newTitle =  Obj Title ( context :   getContext ())           newObj. title   = newTitle           newObj. title ?. name   =   self . title ?. name           newObj. desc   =   self .  desc          return   newObj       }