Foundation Frameworks (Property and variable types)
Video Description
NSObject
NSObject is the root class of most Objective-C class hierarchies. Through NSObject, objects inherit a basic interface to the runtime system and the ability to behave as Objective-C objects (Don't worry if you don't understand the definition, we will talk about it later).NSString & NSMutableString
In order to define a String type variable or property in Objective-C language we use NSString like bellow:
@property (nonatomic, strong) NSString *myString;
If you want to modify the existing string, instead of NSString type you should use NSMutableString, which is mutable version of the NSString
@property (nonatomic, strong) NSMutableString *myMutableString;
NSArray & NSMutableArray
Ordered collection of objects. In order to define an Array type variable or property in Objective-C language we use NSArray like bellow:
@property (nonatomic, strong) NSArray *myArray;If we want to add or remove object to the array or any other modification we have to use NSMutableArray type like bellow:
@property (nonatomic, strong) NSMutableArray *myMutableArray;
NSDictionary & NSMutableDictionary
Look up objects using a key to get a value. In order to define a dictionary with keys and values in Objective-C language we use NSDictionary like this:
@property (nonatomic, strong) NSDictionary *myDictionary;If we want to have a modifiable version of NSDictionary we should use NSMutableDictionary type like bellow:
@property (nonatomic, strong) NSMutableDictionary *myMutableDictionary;
NSNumber
Object wrapper around primitive types like int, float, double, BOOL, etc. It is useful when you want to put these primitive types in an NSArray or NSDictionary. We can define it like bellow:@property (nonatomic, strong) NSNumber *myNumber;
No comments:
Post a Comment