0

In Xcode 14.1 when debugger displays Bool?, it is always as nil, no matter what is inside. So this in code:

let v1: Bool? = nil
let v2: Bool? = true
let v3: Bool = true

is displayed as:

(Bool?) v1 = nil
(Bool?) v2 = nil
(Bool) v3 = true

When using "po v2" it displays it correctly as:

▿ Optional<Bool>
  - some : true

Can someone explain?

Juraj Antas
  • 3,059
  • 27
  • 37
  • 1
    Looks like a bug. Similar issues were reported here: https://stackoverflow.com/q/58855037/1187415, and here: https://stackoverflow.com/q/58108824/1187415 – Martin R Nov 25 '22 at 15:51
  • @MartinR At the time, I thought the issue was limited to Foundation overlay types such as Data and URL. I'm surprised to learn that it applies also to simple Bool. I don't know whether that was also true at the time and now I have no way to find out. :) – matt Nov 25 '22 at 15:58
  • @matt: Yes, I though so as well, I and don't know if this is a new bug or not. But I can reproduce it with Xcode 14.1. – Martin R Nov 25 '22 at 16:00
  • Here is another report: https://developer.apple.com/forums/thread/698633 – Martin R Nov 25 '22 at 16:04
  • @MartinR Yes, agreed. – matt Nov 25 '22 at 16:13

0 Answers0