NNPopObjc
NNPopObjc is inspired by protocol oriented programming, it provides extensibility for the protocol.
Documents
- Read the NNPopObjc Guide document.
Quick Start
Declaring a Procotol
Declaring the Procotol in a .h
file
@protocol NNDemoProtocol <NSObject>
@optional
- (void)sayHelloPop;
+ (void)sayHelloPop;
@end
Extending the Procotol
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
Adopting the Procotol
- Creating a Class
@interface NNDemoObjc : NSObject <NNDemoNameProtocol>
@end
- Implementing the Class
@implementation NNDemoObjc
@end
Using the Class
- Calling the Methods
[NNDemoObjc sayHelloPop];
[[NNDemoObjc new] sayHelloPop];
- Outputting
+[NNDemoObjc sayHelloPop] code say hello pop
-[NNDemoObjc sayHelloPop] code say hello pop
Installation
NNPopObjc supports multiple methods for installing the library in a project.
Installation with CocoaPods
You can install it with the following command:
$ gem install cocoapods
Podfile
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
If installation failed with error:
[!] Unable to find a specification for `NNPopObjc`
try install with the following command:
pod install --repo-update
Installation with Carthage
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.
inspired
License
NNPopObjc is released under the MIT license. See LICENSE for details.