How to handle reachability in iOS

Issue #209 Here are what I learn about reachability handling in iOS, aka checking for internet connection. Hope you will find it useful, too. This post starts with techniques from Objective age, but many of the concepts still hold true The naive way Some API you already know in UIKit can be used for checking internet connection. Most of them are synchronous code, so you ’d better call them in a background thread...

April 17, 2019 · 5 min · 880 words · Khoa

Understanding weak and strong in Objective C

Issue #164 From my own blog post https://github.com/Fantageek/fantageek.github.io/blob/source/source/_posts/2014-06-27-understanding-weak-self-and-strong-self.markdown Blocks are wonderful. To avoid retain cycle you often see the weakSelf - strongSelf dance like this __weak __typeof__(self) weakSelf = self; self.block = ^{ __typeof__(self) strongSelf = weakSelf; [strongSelf doSomething]; [strongSelf doSomethingElse]; }; When block is created Block is object when it is copied Blocks are created on the stack and will go away when their stack frame returns. While on the stack, a block has no effect on the storage or lifetime of anything it accesses....

May 31, 2018 · 3 min · 604 words · Khoa