Swift WTF: Weirdness, traps, and fixes
summary
Expect specifics: binary floating math shows 0.1 + 0.2 != 0.3 so use Swift Numeric or use a Decimal type for exactness; operator precedence makes -10^2 evaluate as -(10^2) so add parentheses to get (-10)^2; copying an implicitly unwrapped optional drops its IUO flag so treat it as a regular optional or stop using IUOs; Array syntax can create IndexPath when Foundation is present so comparative operators behave differently—use lexicographicallyPrecedes or make comparisons explicit; emoji flag replacement breaks with Objective‑C APIs, prefer Swift native string APIs.
AI-written summary · about
chapters (7)
- 0:00Swift WTF intro
- 2:07Floating point surprises
- 6:45Operator precedence pitfalls
- 9:13Implicitly unwrapped optionals
- 10:43Foundation array comparisons
- 13:39Emoji flag replacement bug
- 18:23Summary and help in Japan








