Posts

Rollback is not working for coreData entities

Solution: You could simply refetch the coredata entities for unsaved changes. But you can restart the app the unsaved changes will be discarded.So you must have to save the changes. But you changed in persistant store with current context then the changes will be available in before saving.You can try the rollback context to discard the last changes. Also undomanager available in coredata.You could try that to start the changes and rollback to the particular point....

rollback() not works coredata

Solution: In coredata if you tried rollback then the current context will be rolled back.But if you tried with global context it will never works.So you have try that in cancel you will rollback after comeback to that screen you have to do another rollback in viewDidload. Then it will works good

CollectionVIew size for item not sets for zero.It displays wrong size swift || sizeForItemAt return 0 but cell came || UICollectionView sizeForItemAt Called But Not Sized Correctly

Problem: I had tried to set the size for item zero but it not sets properly.For that it returns sized value. collection View(_: layout: size For Item At:)              let  newSize =  my Array . count   >   0  ?  CGSize (width: width / 3 , height: width / 3 ) :  CGSize (width:  0 , height:  0 ) return  newSize Solution: Because in apple they already said that you must have to set the size value to be non zero.              let  newSize =  my Array . count   >   0  ?  CGSize (width: width / 3 , height: width / 3 ) :  CGSize (width:  0.5 , height:  0.5 ) return  newSize Use the above code it will works good.

cllocationdegrees to double iOS swift

Solution: I had tried to convert the cllocation to double using the below code.But it shows warning.Use the below code to avoid the warning                     lat =  Double ( LocationSingleton . share dInstance . lastLocation ?. coordi nate . latitude  ??  0 )

updater frameInterval depricated in iOS swift

Solution: The below code is depricated in iOS 13.0.              updater . frameInterval  =  1 We can use after iOS 13.0 try the below code              updater . preferredFramesPerSe cond  =  1

Add 30 minutes to the date in iOS swift

Solution: The below code is used to add the 30 minutes to the current date and time. let date = startDate . addingTimeInterval ( 30 * 60 )

iOS Swipecellkit editaction close swift || swipe collectionviewcell going blank white swift

Problem: While i had tried to call edit actions in swipe cell kit after navigation to other screen came back to collectionView cell data hides and it shows as blank. Solution: If you are tried to editaction after that you call the below method then the above problem solves.Because if you are called the edit action you must have to resign the edit action.              let  cell = collectionView. cellForItem (at: indexPath)  as !  NoteCollectionCell             cell. hideSwipe (animated:  true , completion:  nil ) You have to call the above function in the below method.      public   func   collectionView ( _  collectionView:  UICollectionView , editActionsForItemAt indexPath:  IndexPath , for orientation:  SwipeActionsOrientation ) -> [ SwipeAction ]? { }