Giter Site home page Giter Site logo

jyrouter's Introduction

JYRouter

License MIT  CocoaPods  CocoaPods  Support 

Router framework is based on runtime to push/present/pop/dismiss for iOS

Features

  • Compatibility: Support for Objective-C and Swift

  • Ease of use: Support property auto assignment and completion callback

  • Low coupling: No need to inherit the base class or follow the protocol, plug and play

  • Applicability: Supports jumps other than UIViewController

Usage

Jump

Objective-C

// Push
[[JYRouter router] push:@"JYViewController"];
	
// Push, Params
NSDictionary *params1 = @{ @"title" : @"JYRouter"};
[[JYRouter router] push:@"JYViewController" animated:YES params:params1];
	
// Push, Params, Callback
NSDictionary *params2 = @{@"type" : @(0)};
[[JYRouter router] push:@"JYViewController" animated:YES params:params2 completion:^{
	NSLog(@"🔥🔥🔥Push completion callback🔥🔥🔥");
}];

Swift

// Push
JYRouter().push("JYViewController")

// Push, Params
let params1 = ["title" : "JYRouter"]
JYRouter().push("JYViewController", animated: true, params: params1)

// Push, Params, Callback
let params2 = ["title" : "JYRouter"]
JYRouter().push("JYViewController", animated: true, params: params2, completion: {
	print("🔥🔥🔥Push completion callback🔥🔥🔥")
})

Custom NavigationController

Objective-C

// Set in AppDelegate
[[JYRouter router] setCustomNavigationClass:[JYNavigationController class]];

Swift

// Set in AppDelegate
JYRouter().setCustomNavigationClass(JYNavigationController.self)

Installation

CocoaPods

  1. Add pod 'JYRouter' to your Podfile.

  2. Run pod install or pod update.

  3. Objective-C

    1. #import "JYRouter.h"

    Swift

    1. Create "YourProjectName-Bridging-Header.h" bridging header file
    2. #import "JYRouter.h" in the bridging header file

Manually

  1. Download all the files in the JYRouter subdirectory.

  2. Add the source files to your Xcode project.

  3. Objective-C

    1. #import "JYRouter.h"

    Swift

    1. Create "YourProjectName-Bridging-Header.h" bridging header file
    2. #import "JYRouter.h" in the bridging header file

License

JYRouter is released under the MIT license. See LICENSE file for details.


中文介绍

基于runtime实现的iOS路由框架

特性

  • 兼容性: 支持Objective-C和Swift
  • 易用性: 支持属性自动赋值和完成回调
  • 低耦合: 无需继承基类或遵循协议,即插即用
  • 适用性: 支持UIViewController之外其他类的跳转

使用方法

Jump

Objective-C

// Push跳转
[[JYRouter router] push:@"JYViewController"];
	
// Push跳转,附带参数
NSDictionary *params1 = @{@"title" : @"JYRouter"};
[[JYRouter router] push:@"JYViewController" animated:YES params:params1];
	
// Push跳转,附带参数,完成回调
NSDictionary *params2 = @{@"type" : @(0)};
[[JYRouter router] push:@"JYViewController" animated:YES params:params2 completion:^{
	NSLog(@"🔥🔥🔥Push完成回调🔥🔥🔥");
}];

Swift

// Push跳转
JYRouter().push("JYViewController")

// Push跳转,附带参数
let params1 = ["title" : "JYRouter"]
JYRouter().push("JYViewController", animated: true, params: params1)

// Push跳转,附带参数,完成回调
let params2 = ["title" : "JYRouter"]
JYRouter().push("JYViewController", animated: true, params: params2, completion: {
	print("🔥🔥🔥Push完成回调🔥🔥🔥")
})

自定义NavigationController

Objective-C

// 在AppDelegate设置
[[JYRouter router] setCustomNavigationClass:[JYNavigationController class]];

Swift

// 在AppDelegate设置
JYRouter().setCustomNavigationClass(JYNavigationController.self)

安装

CocoaPods

  1. 在 Podfile 中添加 pod 'JYRouter'。

  2. 执行 pod install 或 pod update。

  3. Objective-C

    1. #import "JYRouter.h"

    Swift

    1. 建立 "你的工程名-Bridging-Header.h"桥接文件
    2. 在该桥接文件中 #import "JYRouter.h"

手动安装

  1. 下载 JYRouter 文件夹内的所有内容。

  2. 将 JYRouter 内的源文件添加(拖放)到你的工程。

  3. Objective-C

    1. #import "JYRouter.h"

    Swift

    1. 建立 "你的工程名-Bridging-Header.h"桥接文件
    2. 在该桥接文件中 #import "JYRouter.h"

许可证

JYRouter 使用 MIT 许可证,详情见 LICENSE 文件。

jyrouter's People

Contributors

job-yang avatar

Watchers

 avatar

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.