Skip to content
一款针对于iOS的基于自定义URL的轻量级的路由跳转框架(An url-based and light-weight router for iOS app)
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Example
WSRouter
.gitignore
.travis.yml
LICENSE
README.md
WSRouter.podspec
_Pods.xcodeproj

README.md

WSRouter

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

Cocoapods

WSRouter is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'WSRouter'

Source code

WSRouter/Classes文件夹下的所有.h、.m文件拖入工程中。

Usage

1.引入主头文件#import <WSRouter/WSRouter.h>#import WSRouter.h

2.在+(void)load方法中使用WSRouter的registerRouterWithPrefixURL系列方法注册URL

3.使用transferFromViewController系列方法实现控制器跳转

Example

1.注册

+ (void)load {
    NSURL *url = [NSURL URLWithString:@"WS://www.ws.com/first"];
    [WSRouter registerRouterWithPrefixURL:url handler:^UIViewController *(NSURL *URL, UIViewController *sourceViewController) {
        UIViewController *destViewController = [[WSPushedViewController alloc] init];
        [WSRouter transferViewController:destViewController
                      fromViewController:sourceViewController
                              transition:WSTransitionPush];
        return destViewController;
    }];
}

2.跳转

[WSRouter transferFromViewController:self toURL:[NSURL URLWithString:@"WS://www.ws.com/first?uid=666"]];

Author

ws, wanggyanmo@163.com

License

WSRouter is available under the MIT license. See the LICENSE file for more info.

You can’t perform that action at this time.