Post

Replies

Boosts

Views

Activity

Double value cannot be converted to UInt8 because the result would be less than UInt8.min
I have a swift callback function that accumulates data from the gyroscope handler CMGyroData to value, and takes care that it never goes below zero. Any thoughts why I got this crash? var value: Double = 90 func test(d: Double) { value -= d if value < 0 { value = 0 } else if value > 180 { value = 180 } // Double value cannot be converted to UInt8 because the result would be less than UInt8.min // according to Xcode, value is 0 let angle = UInt8(value.rounded()) print(angle) } During the crash, the debugger shows that value is 0, and the raw memory is 0x0000000000000000. I've heard about negative zero, but then the raw memory would be 0x8000000000000000. Either way, it makes no sense for the UInt8 constructor to fail. (lldb) p value (Double) 0 (lldb) p value.rounded() (Double) 0 (lldb) p UInt8(value.rounded()) (UInt8) 0 Xcode 15.1, iPhone 7 Plus, iOS 15.8 Edit: As a good measure, I changed that line to let angle = UInt8(Int(value.rounded()))
7
0
1.9k
Dec ’23
iPhone as a network run destination broken in Xcode 15.0 (15A240d)
Since Xcode Version 15.0 (15A240d) I can no longer use my iPhone as a network run destination. Connect via IP Address also does not work. USB works and the iPhone 7, iOS 15.7.9 is prepared for development. Restarting the iPhone or Mac Book Pro 2019 does not help. If I run Xcode 14, the phone is automatically prepared for development over the network and I can run and debug apps.
1
0
649
Sep ’23
Safari 26 close and Refresh buttons not working in Compact tab layout
Safari 26 close and Refresh buttons not working in Compact tab layout
Topic: Safari & Web SubTopic: General
Replies
5
Boosts
3
Views
448
Activity
Sep ’25
Customise Touch Bar unavailable in Xcode 26.0 (17A324)
Touch Bar items: Jump to destination and Ident missing and Customise Touch Bar unavailable in Xcode 26.0 (17A324).
Replies
2
Boosts
0
Views
140
Activity
Sep ’25
Tab titles truncated and unreadable Xcode 26.0 (17A324)
Tab titles are truncated and unreadable when many tabs are open. The old scrolling behaviour in Xcode 16.4 was better. Xcode 26.0 Xcode 16.4
Replies
1
Boosts
1
Views
154
Activity
Sep ’25
Double value cannot be converted to UInt8 because the result would be less than UInt8.min
I have a swift callback function that accumulates data from the gyroscope handler CMGyroData to value, and takes care that it never goes below zero. Any thoughts why I got this crash? var value: Double = 90 func test(d: Double) { value -= d if value < 0 { value = 0 } else if value > 180 { value = 180 } // Double value cannot be converted to UInt8 because the result would be less than UInt8.min // according to Xcode, value is 0 let angle = UInt8(value.rounded()) print(angle) } During the crash, the debugger shows that value is 0, and the raw memory is 0x0000000000000000. I've heard about negative zero, but then the raw memory would be 0x8000000000000000. Either way, it makes no sense for the UInt8 constructor to fail. (lldb) p value (Double) 0 (lldb) p value.rounded() (Double) 0 (lldb) p UInt8(value.rounded()) (UInt8) 0 Xcode 15.1, iPhone 7 Plus, iOS 15.8 Edit: As a good measure, I changed that line to let angle = UInt8(Int(value.rounded()))
Replies
7
Boosts
0
Views
1.9k
Activity
Dec ’23
iPhone as a network run destination broken in Xcode 15.0 (15A240d)
Since Xcode Version 15.0 (15A240d) I can no longer use my iPhone as a network run destination. Connect via IP Address also does not work. USB works and the iPhone 7, iOS 15.7.9 is prepared for development. Restarting the iPhone or Mac Book Pro 2019 does not help. If I run Xcode 14, the phone is automatically prepared for development over the network and I can run and debug apps.
Replies
1
Boosts
0
Views
649
Activity
Sep ’23