GithubHelp home page GithubHelp logo

orouter's Introduction

ORouter

fork SDRouter + oc-runtime

看到SDRouter后,发现原理很简单,然而和其他router框架一样都需要主动添加各种block,因此为了解放block,ORouter 诞生了。

特性

  • 自动装载路由block
  • 采用define添加路由
  • 支持加载storyboard中的viewcontroller

使用

  1. 安装

    pod 'ORouter'
  2. 创建TestViewController

    TestViewController.h

    #import <UIKit/UIKit.h>
    #import <ORouter/ORouter.h>
    @interface TestViewController : ORouterViewController
    @end

    TestViewController.m

    #import "TestViewController.h"
    
    #define SCHEMA_EASY @"easy"
    #define HOST_EASY @"router.flyma.top"
    
    #define ROUTE_PATH_SECOND HOST_EASY@"/second/test"
    
    @interface TestViewController ()
    
    @end
    
    @implementation TestViewController
    
    ROUTER_PATH(SCHEMA_EASY, ROUTE_PATH_SECOND)
    ROUTER_STORYBOARD(Main, TestViewController)
    
    - (void)viewDidLoad {
        [super viewDidLoad];
        self.title = @"Second";
        NSLog(@"%@", self.params);
    }
    
    @end
  3. 进入路由

    [[ORouter shareRutor] openRoute:[NSURL URLWithString:@"easy://router.flyma.top/second/test?test=23"]];
    

    采用标准URL规范,queryString 会自动绑定ORouterViewController的params

License

Copyright 2018 zhe Zhu

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

orouter's People

Contributors

snice avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

zss1990

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.