I know that there are many different reasons why a developer might pick one approach over another when tackling any given question. But here’s my line of thinking regarding tests. There is value in writing tests after the implementation. It helps us feel more confident when the code later needs to be refactored or changed.Continue reading “Why Choose TDD Over Writing Tests After the Code?”
Author Archives: Oleksii
StoreKit 2 Refresh Receipt
Even though StoreKit 2 keeps everything in sync automatically, the HIG still requires us to have Restore Purchase button. In Original API for In-App Purchase we’d either call SKRefreshReceiptRequest or restoreCompletedTransactions() on instance of SKPaymentQueue. In StoreKit 2 an equivalent to that would be AppStore.sync(). In regular operations, there’s no need to call sync(). StoreKit automaticallyContinue reading “StoreKit 2 Refresh Receipt”
TIL Xcode can Format to Multiple Lines
I’ve been coding a lot over the past few weeks, and much of the work was to make the code look better by formatting long lines into multiline. Like changing this: to this: It becomes tedious when needed to do a lot, so I’ve looked into automation. I believed I heard that Xcode added nativeContinue reading “TIL Xcode can Format to Multiple Lines”
TIL asl – Apple System Log
Today I noticed a strange behaviour in my Xcode’s console. I was testing iOS app background launch, more specifically, the case when the app is launched in background due to Watch Connectivity sendMessage method called on watchOS side. I was using “Wait for the executable to be launched” to get some console logs, but noneContinue reading “TIL asl – Apple System Log”
TIL dynamic libraries are only partially loaded at launch in iOS
Recently I’ve stumbled on the issue that I didn’t receive a “Class is implemented in both” warning message, whereas I should’ve, because I referenced the same static library both from the app and indirectly through my custom dynamic framework. The reason was, even though I imported the dynamic framework, I never referenced its symbols. AFAIKContinue reading “TIL dynamic libraries are only partially loaded at launch in iOS”
Fix issue: keys won’t load automatically to ssh-agent from ssh config file
First of all AddKeysToAgent option will only load keys from config file on first use. So don’t expect to see identities in the agent list before that, e.g. after shell login. If you want to test “first use” you can clear all identities from agent using ssh-add -D, and then run some command that willContinue reading “Fix issue: keys won’t load automatically to ssh-agent from ssh config file”
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.”