When I am debugging a Swift app in Xcode, the debugger expects expressions in Swift format. How can I switch it to expect Objective-C expressions instead?
E.g., I want to be able to type expr id $foo = [[SomeClass alloc] initWithBar:@"quux"];
instead of whatever the Swift equivalent is.
lldb is a command-line debugger (we may see graphical debuggers later in the semester.) “LLVM” is the compiler framework that includes many things, including the clang compiler that we are using, as well as lldb. gdb is another commonly-used debugger.
lldb is the default debugger in Xcode on macOS and supports debugging C, Objective-C and C++ on the desktop and iOS devices and simulator. All of the code in the LLDB project is available under the Apache 2.0 License with LLVM exceptions.
Swift 3.0 or before use: You can use the following command to identify the name of all available languages in LLDB.
Swift 4.0
Create an alias like "eco" to print objective-c objects:
(lldb)command alias eco expression -l objective-c -o --
(lldb)eco [[UIApplication sharedApplication] userHomeDirectory]
/Users/...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With