Reloading existing items when using Diffable Data Source

TL;DR Applying data source snapshot didn’t reload existing items as expected. Apple’s updated doc is pretty comprehensive on the subject, and covers the issue. Though reload and reconfigure need to be done manually, at least there is now an “official” way to do it. The issue: Diffable Data Source won’t reload items automatically For someContinue reading “Reloading existing items when using Diffable Data Source”

TIL: lldb po strongly captures an object, forever

While investigating some memory leak issue, I found out that if I po an object before using Memory Graph, that object would stay in memory forever, and Memory Graph would show something like NSKeyValueDependencyInfo as an owner of the object. A leak will also happen when using p or expression. See for more details: https://github.com/kastiglione/swift_po.

Xcode UI Tests: infinite “wait for app to idle”

Last time I encountered this issue, it was hard to find the reason. We don’t know much about what actually UI Tests system waits for in such cases. There are rumours over internet that activity on main thread is what it looks for, but it’s not always the case. Let’s go over few tips thatContinue reading “Xcode UI Tests: infinite “wait for app to idle””

UI Tests are asynchronous and dynamic. Issues and tips.

TL;DR Use snapshot() method of XCUIElement in order to get consistent element information. Asynchronous nature of UI Tests Tests happen in a separate process, Test Runner, that doesn’t have access to actual views of our App. Runner talks to App using some special communication channel, probably inter-process mechanism. Our code dispatches requests to this mechanism,Continue reading “UI Tests are asynchronous and dynamic. Issues and tips.”

Your Core Data fetches may return unexpected results, or why you should use Query Generations

The issue I am going to talk about is relevant to anyone who uses Core Data. It is an “invisible” issue that may show up so rarely that it’s almost impossible to debug. It is only catchable by repeated automated tests. Let’s take a look at the piece of code that has single perform(_:) whichContinue reading “Your Core Data fetches may return unexpected results, or why you should use Query Generations”

AVMutableVideoCompositionLayerInstruction assetTrack

For AVVideoComposition to work correctly, you should init AVMutableVideoCompositionLayerInstruction with AVCompositionTrack created by you, instead of AVAssetTrack provided by AVAsset. This may be unintuitive at first, because how do you apply instructions to the track you want? How do you do transitions if there is only one AVCompositionTrack? Well, you’d create two, and alternate betweenContinue reading “AVMutableVideoCompositionLayerInstruction assetTrack”

TIL sif – step into function

When Swift came out, I kinda stopped using Xcode’s Step Into process control in Debug Bar, mostly due to Swift’s more frequent usage of accessors and computed properties etc. But 2016’s WWDC talk Debugging Tips and Tricks https://developer.apple.com/videos/play/wwdc2016/417/ says that I shouldn’t abandon trying. I recommend you watching the whole video, or at least theContinue reading “TIL sif – step into function”