WHAT DOES THE @ SYMBOL REPRESENT IN OBJECTIVE-C.

Tarun Kumar

Total Post:107

Points:535
Posted by  Tarun Kumar
 691  View(s)
Ratings:
Rate this:
  1. Tarun Kumar

    Post:107

    Points:535
    What does the @ symbol represent in objective-c.

    Objective-C frameworks typically do not use C-style strings. Instead, they pass strings around as NSString objects.

    The NSString class provides an object wrapper for strings that has all of the advantages you would expect, including built-in memory management for storing arbitrary-length strings, support for Unicode, printf-style formatting utilities, and more. Because such strings are used commonly though, Objective-C provides a shorthand notation for creating NSString objects from constant values. To use this shorthand, all you have to do is precede a normal, double-quoted string with the @ symbol, as shown in the following examples:

    NSString *myString = @"My String\n";

    NSString *anotherString = [NSString stringWithFormat:@"%d %@", 1, @"String"];

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!