Retry! in the wild

In perfect world every action finish with the success. In real world it's not. In perfect world sending network request returns with a result. In real world it fail sometimes due to dozen of reasons, and since we're living in the real world I have to deal with it. don't…

Code at the end of the queue

NSOperation and NSOperationQueue are great and useful Foundation framework tools for asynchronous tasks. One thing puzzled me though: How can I run code after all my queue operations finish? The simple answer is: use dependencies between operations in the queue (unique feature of NSOperation). It's just 5 lines of code…

Swift reflection about food

Reflection in practice Reflection technique may be useful to build quasi generic functions that operate at runtime. It may be quasi type safe, though it uses runtime too - as such can't be optimised/validated during compilation. With Objective-C we used <runtime/objc.h> and do all the…

ChunkSequence 🔪🍰

Have cake and eat it Have a cake and consume the cake by the Swift function, at the same time. Magic. The nature of the Swift type is that it is copied or copied on write. When I assign A to B (A = B), then effectively B is copy of…

Fast pattern search in Swift... since 1974

the fastest known ways to find one string of characters in another [1] Stay with me. At the beginning brief introduction, later on Swift implementation, tests and conclusion. Halt and Catch Fire thing I really enjoy Halt and Catch Fire tv show. Season 1 was about hardware, while season 2…