✅ SOLVED!
The issue was caused by Swift compiler optimizations.
In Build Settings
, under Swift Compiler - Code Generation → Optimization Level
,
select No Optimization [-Onone]
instead of any optimized level (like -O
or -Osize
).
It seems that enabling optimization affects the behavior of the Stream APIs.
Once optimizations are disabled, everything works correctly again.