All Projects → luoqisheng → Annotationkit

luoqisheng / Annotationkit

Licence: mit
The annotation implementation using Objective-C

Projects that are alternatives of or similar to Annotationkit

Beehive
🐝 BeeHive is a solution for iOS Application module programs, it absorbed the Spring Framework API service concept to avoid coupling between modules.
Stars: ✭ 4,117 (+5954.41%)
Mutual labels:  plugin, module, lifecycle
core
augejs is a progressive Node.js framework for building applications. https://github.com/augejs/augejs.github.io
Stars: ✭ 18 (-73.53%)
Mutual labels:  module, lifecycle
Miox
Modern infrastructure of complex SPA
Stars: ✭ 374 (+450%)
Mutual labels:  plugin, lifecycle
Wordpress Indieweb
Helps you establish your IndieWeb identity by extending the user profile to provide rel-me and h-card fields. It also includes a bundled installer for a core set of IndieWeb-related plugins.
Stars: ✭ 64 (-5.88%)
Mutual labels:  plugin
Docsify Tabs
A docsify.js plugin for rendering tabbed content from markdown
Stars: ✭ 65 (-4.41%)
Mutual labels:  plugin
Kong Plugin Response Cache
A Kong plugin that will cache responses in redis
Stars: ✭ 66 (-2.94%)
Mutual labels:  plugin
Epee React Admin Ts
🗡简洁、高效、易扩展的 React 快速开发模板,基于布局设计,纯 Hooks 开发,提供全链路类型检查及工具
Stars: ✭ 68 (+0%)
Mutual labels:  module
Stylelint Validator
Stylelint plugin to validate CSS syntax
Stars: ✭ 64 (-5.88%)
Mutual labels:  plugin
Komada
Komada: Croatian for `pieces`, is a modular bot system including reloading modules and easy to use custom commands.
Stars: ✭ 67 (-1.47%)
Mutual labels:  module
Easychatandroidclient
EasyChat是一个开源的社交类的App。主要包含消息、好友、群组等相关的IM核心功能。部分界面参照了QQ、微信等相关社交APP。EasyChat APP整体采用MVVM模式,基于JetPack(Lifecycle,LiveData,ViewModel,Room)构建
Stars: ✭ 64 (-5.88%)
Mutual labels:  lifecycle
Daggraph
Dagger dependency graph generator for Android Developers
Stars: ✭ 1,140 (+1576.47%)
Mutual labels:  module
Multihighlight
Jetbrains IDE plugin: highlight identifiers with custom colors 🖌💡
Stars: ✭ 65 (-4.41%)
Mutual labels:  plugin
Chartjs Plugin Deferred
Chart.js plugin to defer initial chart updates
Stars: ✭ 65 (-4.41%)
Mutual labels:  plugin
Obs Streamfx
StreamFX is a plugin for OBS Studio which adds many new effects, filters, sources, transitions and encoders - all for free! Be it 3D Transform, Blur, complex Masking, or even custom shaders, you'll find it all here.
Stars: ✭ 1,128 (+1558.82%)
Mutual labels:  plugin
Base
Base is the foundation for creating modular, unit testable and highly pluggable, server-side node.js applications.
Stars: ✭ 67 (-1.47%)
Mutual labels:  plugin
Scxcodeeditorinset
Xcode plugin that adds an empty (configurable) space to the end of the editor text view
Stars: ✭ 64 (-5.88%)
Mutual labels:  plugin
Import Http
Import modules from URL instead of local node_modules
Stars: ✭ 1,150 (+1591.18%)
Mutual labels:  module
Simple Jekyll Search
A JavaScript library to add search functionality to any Jekyll blog.
Stars: ✭ 1,133 (+1566.18%)
Mutual labels:  plugin
React
Smart Server Performance
Stars: ✭ 65 (-4.41%)
Mutual labels:  plugin
Aacomponents
基于google Android Architecture Components 封装实现组件式MVP快速开发框架
Stars: ✭ 66 (-2.94%)
Mutual labels:  lifecycle

AnnotationKit

The annotation implementation using Objective-C

0x00 Abstract

an annotation is a form of syntactic metadata that can be added to Objective-C source code, like the java annotation.

0x01 What can it do?

  • @when for event dispatch.
@When(AppLaunched,ViewController,@selector(doLaunched:))
+ (void)doLaunched:(NSNotification *)note
{
    NSLog(@"%@",note);
}

@When(AppEnterForeground,ViewController,@selector(doEnterForeground:))
+ (void)doEnterForeground:(NSNotification *)note
{
    NSLog(@"%@",note);
}

@When(AppEnterBackground,ViewController,@selector(doEnterBackground:))
+ (void)doEnterBackground:(NSNotification *)note
{
    NSLog(@"%@",note);
}

@When(AppResignActive,ViewController,@selector(doResignActive:))
+ (void)doResignActive:(NSNotification *)note
{
    NSLog(@"%@",note);
}

@When(AppBecameActive,ViewController,@selector(doBecameActive:))
+ (void)doBecameActive:(NSNotification *)note
{
    NSLog(@"%@",note);
}
  • @RequestMapping for url route.
//ViewController.m
@RequestMapping(ViewController, "demo://demo/index/")
@implementation ViewController
@end

0x03 extendable

  1. Subclass the PHAnnotationHandler

  2. use @DefineAnnotation() to define your annotation.

  3. override -(void)handleAnnotationConfig:(NSArray<NSString *>*)configs; to gain your meta data

  4. an example : Use HHRoute to impl my @RequestMapping

    //AKRouteAnnotation.h
    #import <Foundation/Foundation.h>
    #import "AKEngine.h"
    
    //provides the @RequestMapping
    #ifndef RequestMapping
    #define RequestMapping(name,url) \
    class AKEngine; char *const NameGen(name,_url) AnnotationDATA(route) = "{\""#name"\":"#url"}";
    #endif
    
    @interface AKRouteAnnotation : PHAnnotationHandler
    @end
    

    //AKRouteAnnotaion.m
    #import "AKRouteAnnotaion.h"
    #import "NSDictionary+AnnotationKit.h"
    #import <HHRouter/HHRouter.h>
    @interface AKRouteAnnotaion ()
    @end
     //arg0 :AKRouteAnnotaion for class name, arg1: route which is defined in AnnotationDATA ,
    @DefineAnnotation(AKRouteAnnotaion,route)
    @implementation AKRouteAnnotaion
    - (void)handleAnnotationConfig:(NSArray<NSString *> *)configs {
        for (NSString *map in configs) {
            NSData *jsonData =  [map dataUsingEncoding:NSUTF8StringEncoding];
            NSError *error = nil;
            id json = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&error];
            if (!error) {
                
                if ([json isKindOfClass:[NSDictionary class]] && [json allKeys].count == 1) {
                    NSString *clsName = [[json allKeys] firstObject];
                    NSString *url = [json akSafeObjectForKey:clsName];
                    if (clsName && url) {
                        [[HHRouter shared]map:url toControllerClass:NSClassFromString(clsName)];
                        [self.configs addObject:@{url:clsName}];
                    }
                }
                
            }
        }
    }
    @end
    

0x04 License

  • AnnotationKit

    MIT License
    
    Copyright (c) 2017 luoqisheng
    
    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:
    
    The above copyright notice and this permission notice shall be included in all
    copies or substantial portions of the Software.
    
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    SOFTWARE.
    
    

  • libextobjc

    Copyright (c) Justin Spahr-Summers
    
    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
    
    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
    
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].