Pages

Friday, January 11, 2013

How to print String in Xcode/Swift


To Print String in xCode:

I am reading a TextField String from xib. (labelName is the name of Label);

Objective C:


NSString *userId = [[NSString alloc] initWithString:labelName.text];
printf("String is %s", [userId UTF8String]);
[userId release];

Swift:

var userId = labelName.text
print(userId?.utf8)