I recently picked up Swift. This article is about some of the things in Swift that I thought were cool. I will probably update this as I come upon more cool stuff, which is bound to happen as I’m still starting out.
code posts
- A glance at Swift 2 minutes
- Avoiding assertions in TypeScript 6 minutes
Often, when working with Typescript, people tend to go for type assertions to suppress errors. Though that does suppress the immediate error, it is often the case that you’re causing yourself a pain by not fixing the underlying issue, and exposing yourself to bugs at runtime. The main advantage of Typescript is the types we define, the more accurate they are to reality the less often you’ll encounter type related bugs in production.The rest of this article is about type assertion, non null assertion, and how to avoid it.
📖
"You are angry with me for not appearing to you in a red glow, with thunder and lightning, with scorched wings, but appearing in such a modest guise. You are insulted, first, in your aesthetic feelings, and, secondly, in your pride: how could such a vulgar devil come to such a smart man?"
— The Devil