how to implement private function in Objective-c?

Jameskrauser Lee
1 min readFeb 7, 2018

--

objective-c don’t have private keyword ,
if you want to implement private function in objective-c
just add @interface before @implementation in .m file
(almost @interface only write in .h file)

xxx.m file

#import “private_func.h”
@interface private_func()
-(void) doMyPrivateFunction;
-(int) getNumber;
@end
@implementation private_func
//code
@end

--

--

Jameskrauser Lee
Jameskrauser Lee

Written by Jameskrauser Lee

For the last few years. i was involved mostly in the development of Automatic Fare collection system for the Chennai Metro. Familiar with C++ and iOS.

No responses yet