I am using NSFetchedResultsController to track changes in the database, but when I add a new item locally, it fires 2 times. First time when creating an object, second time when context.save().
Now I have this
fetchedResultsController.fetchRequest.predicate = nil
...
...
let newItem = Item(context: context) //controller fires right after this #1
...
...
context.save() // Fires here again #2
I don't need it first time as context was not saved yet and entity have temporary ID. So, how to make NSFetchRequest or NSPredicate skip entities with temporary IDs?
Post
Replies
Boosts
Views
Activity
Is there any way to disable interactions for scroll indicator of UITableView?I need to keep vertical scroll indicator visible, but make it transparent for touches.I've tried to set isUserInteractionsEnabled to false for all subviews of UITableView inside awakeFromNib (I've checked, both indicators are there as subviews), but no success, anyway I can touch and drag indicators.
I need to get tiled image in UIImageView with next conditions:Image size will be just the same as screenI need to scroll the image to the left/right in code (animation or gesture)When scrolling, I need to get infinite backgroundI assuming that I need make image tiling, but how to affect something like offset?imageView.image = image.resizableImage(withCapInsets: .zero, resizingMode: .tile)It can be any solution, absolutely not going to be a UIImageView.
How to make Entity unique constraints in Core Data case insensitive? I have an Entity that is keep unique by "name" property.I've added target property in constraints, set context.mergePolicy = NSMergePolicy.rollback . Works correct here, skip entities with the same name.But I want to skip aPpleS when I already have Apples. How to achieve that using merge policy? Does any Core Data solution where I can get case insensitive behavior?
After creating Localizable.strings I cannot add Base localization. I can add any other language, but Base is simply missing. How to allow Base there?
Does it possible to set background color for each section in UITableView separately, not for the whole UITableView?
Shadow disappear on all cells of this type inside tableView once I do insertRow(at:) or deleteRow(at:) in BatchUpdates. Once animation completed shadow appears back for all cells. Any ideas how to keep shadow while insertRow(at:) animates?class PlaceholderCell: UITableViewCell {
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
backgroundColor = .white
selectionStyle = .none
layer.shadowColor = UIColor.black.cgColor
layer.shadowOffset = CGSize(width: 0, height: 10)
layer.shadowRadius = 10.0
layer.shadowOpacity = 0.5
layer.masksToBounds = false
clipsToBounds = false
}
required init?(coder: NSCoder) {
super.init(coder: coder)
}
}
I have UICollectionView carousel with UITableView nested inside each UICollectionViewCell.UICollectionView's layout.scrollDirection = .horizontal, soUITableView scroll up/down works fineUITableViewCell swipe left/right does not work, but parent UICollectionView scrolling is triggered instead.How to keep collectionView.isScrollEnabled true, but prioritise UITableViewCell to allow deleting when swiping on it?
I have custom layout with fullscreen cells. When removing cell from the left (it's not visible at the time), UICollectionView jumps to the next cell. It's like current cell was at index 4 and when cell on the left removed the next cell has index 4 now and immediately scroll to the next cell. Describing in 3 steps (A is cell that need to be fullscreen, x will be removed, o other cells, large letter is fullscreen):ooooAoooooxAoooooaOoBut must keep this oooAoo
I have a UICollectionView with cells that are loading from CoreData.User can reorder cells in UICollectionView (it must be reflected in CoreData).Cells must be loaded in certain order user saved before.Q: How to save/load order in CoreData safely (I will add iCloud sync later also)?I don't mean overall tips like "add index to entity" or similar. I mean real technique that is 100% stable and ready for synching with iCloud, will not cause any problems and data loss, will not rebuild all data each time etc. Thanks for any help!Maybe Core Data has built-in mechanism to handle that. The only thing I've found is ordered one-to-many relationships, but I completely cannot find any detailed info with examples about how it works and even if that's what I am looking for.
UICollectionView don't animate when removing 2nd item of 2 total, just jumps after pre-last item disappear.UICollectionView animates add/remove item fine in all other cases (works fine for deleting 3rd of 3, 4th of 4, 15th of 15 etc) excepting the situation when you try to remove 2nd of 2 item. Have no idea why, does anyone can help me to solve that? Please watch the short video. You can try the ready project as well.***Custom FlowLayout is must have, no chance to remove it.Video explanationhttps://vimeo.com/390343515Sample project on GitHubhttps://github.com/mrbodich/Test-CollectionviewThank you for any help
After usingbeginUpdates()endUpdates()->tableView.setContentOffset(_, animated:) do not workdo not work after calling that 2 methods (even if I use timer), but works without them!Any ideas why? Looks like a bug(((setContentOffset works only if I swipe tableView manually after beginUpdates() + endUpdates() and BEFORE setContentOffset is being called.scrollToRowAtIndexPath works fine though but I need only setContentOffset.
Hi, How to keep Cells in UICollectionView live, still not destroyed on some distance outside from UICollectionView when it's not visible already?I have 2 reasons if it can help:Shadow disappear once Cell is outside ViewI have animation of custom FlowLayout (zooming out) and it's not perfectly like expected, cell animates from edge, not from few points outside as expected (because animation starts when side Cell was not dequeued yet)So, as for now, UICollectionViewCell is being destroyed once it's not visible. I need it to be destroyed only when it goes for example by 50 points away from the UICollectionView. I need only original cells, not any kind of it's snapshots/copies.Thanks.