July 2017
Intermediate to advanced
284 pages
6h 45m
English
by Natasha Murashev
The standard against which Swift is evaluated is Objective-C, which Apple intends to replace with Swift for its developers. Although Objective-C has some strange-looking syntax compared to other programming languages, the method syntax is pretty straightforward once you get the hang of it. Here’s a quick throwback:
| | + (void)mySimpleMethod |
| | { |
| | // class method |
| | // no parameters |
| | // no return values |
| | } |
| | |
| | - (NSString *)myMethodNameWithParameter1:(NSString *)param1 |
| | parameter2:(NSNumber *)param2 |
| | { |
| | // instance method |
| | // one parameter of type NSString pointer, |
| | // one parameter of type NSNumber pointer |
| | // must return a value of type NSString pointer |
| | return @"hello, world!"; ... |
Read now
Unlock full access