Is there a way to print value of Boolean flag in NSLog?
Is there a way to print value of Boolean flag in NSLog?
In Swift, you can simply print a boolean value and it will be displayed as true or false.
let flag = true
print(flag) //true
BOOL curBool = FALSE;
NSLog(@"curBool=%d", curBool);
-> curBool=0
char* boolToStr(bool curBool){
return curBool ? "True": "False";
}
BOOL curBool = FALSE;
NSLog(@"curBool=%s", boolToStr(curBool));
-> curBool=False