Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Object-Oriented Swift Properties Getter and Setter methods

Terrez dawson-holland
Terrez dawson-holland
1,656 Points

Looking for simple definitions I missed..

Can someone tell me the exact definitions of these words?

Float Double Self

2 Answers

Damien Watson
Damien Watson
27,419 Points

Hey Terrez, I'll give it a go:

'Float' and 'Double' are both variable definitions for decimal numbers. Float is 32-bit while Double is 64-bit, which means Double can cope with larger digits.

'Self' refers to the property or method of a class. A class consists of two files 'header (.h)' and 'implementation (.m)'. The header defines public variables and methods where the implementation can define private types.

Any property or method defined within the class is accessible by preceeding it by 'self'. Quick example:

@interface TestViewController ()
@property NSString *name;
@end

@implementation TestViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.name = @"Terrez";
    NSLog(@"Name : %@",self.name);
}