NNPopObjc is inspired by protocol oriented programming, it provides extensibility for the protocol.
- Read the NNPopObjc Guide document.
Declaring the Procotol in a .h
file
@protocol NNDemoProtocol <NSObject>
@optional
- (void)sayHelloPop;
+ (void)sayHelloPop;
@end
Extending the Procotol needs in a .m
file
///Extending the Procotol for default implemention.
@nn_extension(NNDemoProtocol)
+ (void)sayHelloPop {
DLog(@"+[%@ %s] code say hello pop", self, sel_getName(_cmd));
}
- (void)sayHelloPop {
DLog(@"-[%@ %s] code say hello pop", [self class], sel_getName(_cmd));
}
@end
- Creating a Class
@interface NNDemoObjc : NSObject <NNDemoNameProtocol>
@end
- Implementing the Class
@implementation NNDemoObjc
@end
- Calling the Methods
[NNDemoObjc sayHelloPop];
[[NNDemoObjc new] sayHelloPop];
- Outputting
+[NNDemoObjc sayHelloPop] code say hello pop
-[NNDemoObjc sayHelloPop] code say hello pop
NNPopObjc supports multiple methods for installing the library in a project.
You can install it with the following command:
$ gem install cocoapods
To integrate NNPopObjc into your Xcode project using CocoaPods, specify it in your Podfile
:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
target 'TargetName' do
pod 'NNPopObjc'
end
Then, run the following command:
pod install
[!] Unable to find a specification for `NNPopObjc`
try install with the following command:
pod install --repo-update
Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
You can install Carthage with Homebrew using the following command:
$ brew update
$ brew install carthage
To integrate NNPopObjc into your Xcode project using Carthage, specify it in your Cartfile
:
github "amisare/NNPopObjc" ~> 1.0.6
Run carthage
to build the framework and drag the built NNPopObjc.framework
into your Xcode project.
NNPopObjc is released under the MIT license. See LICENSE for details.