How to view value of Swift let constant in Xcode 6 debugger
This was a bug in Xcode which I can confirm was fixed in Xcode 6.1. (Thanks, Steve Rosenberg.)
This is what I get now, as expected:
The constant is now displayed correctly in the variables view as well, and is no longer listed twice:
Xcode Beta 2 - How can I see the values on swift strings in the debugging window
If you set a breakpoint in your code you can print any variable with the po
command like this:
(lldb) po myString
"hello"
How to change a let value while debugging in Xcode?
The problem is that the compiler might analyze the let constant at compile time and then optimize your code. For example, think of something like:
func x() -> String {
let doit = false
if (doit) {
return "Yes"
} else {
return "No"
}
}
// ...
let result = x()
A clever compiler will change this to
func x() -> String {
return "Yes"
}
// ...
let result = x()
or even throw away the call of x()
completely:
let result = "Yes"
Hence, there is no doit
constant at all, expecially there is no return "No"
branch in your program any more.
This is an extreme example, and the compiler typically will do so only in release mode, but you can see that it's not easy to allow constants to be changed during debugging, because the compiler might have to revert some opimizations.
How to debug member variable (ie., Array, Dictionary) in LLDB?
Finally resolved my issue by changing Enable Clang Module Debugging in Apple LLVM 7.1 Language Modules as following screen shot
Reference : https://stackoverflow.com/a/36176158/4014369
How to use Code value in the info.plist file xcode ios
You can create the variable by adding it as a "User-Defined Setting" to your target, in Build Settings. You can then set the variable value to different things for each of your build configurations.
Please see attached screenshot. You can ignore my Beta Prod and Beta Test configurations, as they probably don't apply to your situation.
CGPoint, NSTimeInterval not showing value on debugger view
This seems to be a bug. I have filed it to Apple under bug #23266337, they have marked it as duplicate for bug #23088739
Related Topics
Swiftui: Navigation Bar Title in Reusable Cross-Platform (iOS & MACos) View
Break on Any Occurrence of "Fatal Error: Unexpectedly Found Nil While Unwrapping an Optional Value"
Swift String VS. String! VS. String
Where Is the .Camera Anchorentity Located
Smooth Transition Between 2 Scrollviews
Nsundomanager Casting Nsundomanagerproxy Crash in Swift Code
Why Can You Assign Non-Optional Values to Optional Types in Swift
How to Represent Magnitude for Mass in Swift
App Crashes When Trying to Append Data to a Child Value
Scene Created in Sprite Kit Level Editor Is Not Working
How to Change Gb-2312 Encoding to Utf-8
How to Encode Realm's List<> Type
Retrieving Keys from Geofire Within Radius in Swift
How to Have a Swift Protocol Without Functions
How Does Typecasting/Polymorphism Work with This Nested, Closure Type in Swift