We’ve been dealing with or avoiding the problem of network connectivity on iOS apps for years. Now you can monitor the network status with a callback sort of like you would with location or other services. And you can specify wi-fi or cellular.
I’m glad this finally made it to the to of Apple’s backlog! 👍
A beautifully elegant way to store Swift properties in UserDefaults or Keychain. This approach really makes the most of Swift extensions and protocol-oriented programming. And more than anything, it makes for very simple, reusable code.
The Swift “defer” operator my not work exactly like you expect. It’s not exactly the last code executed before the function returns. Well, it kind of is. But also not so much. 🤦🏻♂️ As this article says, “defer” basically happens at the “ret” in “return”. 🤯
It takes a while to process what’s going on here, so take your time…
It’s also fascinating to see how what some very simple Swift code looks like when decompiled. Temporary registers. Global var access. Code injection in all the wrong places. 🤯 I have newfound respect for compiler writers.
And thanks to Sergey Smagleev on Medium for a great deep dive into “defer”.
Whoa, a simple three-liner has turned into this abomination that spans 34 lines of code.