All Projects → ViacomInc → Router

ViacomInc / Router

Licence: apache-2.0

Programming Languages

swift
15916 projects

Labels

Projects that are alternatives of or similar to Router

Vmesh
VMesh is a decentralized Layer 3 mesh router and protocol designed for open network interconnection.
Stars: ✭ 25 (-39.02%)
Mutual labels:  router
U Boot mod
U-Boot 1.1.4 modification for routers
Stars: ✭ 884 (+2056.1%)
Mutual labels:  router
React Starter
React Starter repository: cache bursting, css extraction, production, hot, react, redux, router, babel, eslint, jsx, webpack 3, editorconfig
Stars: ✭ 33 (-19.51%)
Mutual labels:  router
Bidi
Bidirectional URI routing
Stars: ✭ 941 (+2195.12%)
Mutual labels:  router
Routing
The Routing component maps an HTTP request to a set of configuration variables.
Stars: ✭ 7,080 (+17168.29%)
Mutual labels:  router
Routex
Modern Node router
Stars: ✭ 20 (-51.22%)
Mutual labels:  router
Vecty Router
A declarative client-side router for Vecty applications.
Stars: ✭ 24 (-41.46%)
Mutual labels:  router
Redux Json Router
Declarative, Redux-first routing for React/Redux browser applications.
Stars: ✭ 37 (-9.76%)
Mutual labels:  router
React Router Component
Declarative router component for React.
Stars: ✭ 879 (+2043.9%)
Mutual labels:  router
Angularconcepts
Key Angular Concepts using Latest Angular version 5
Stars: ✭ 31 (-24.39%)
Mutual labels:  router
Vector
A reliable, high-performance tool for building observability data pipelines.
Stars: ✭ 8,736 (+21207.32%)
Mutual labels:  router
Shgf
Simple HTTP golang framework
Stars: ✭ 13 (-68.29%)
Mutual labels:  router
Bloggerjs
Script para modificar el formato de las URL en un blog de Blogger.
Stars: ✭ 28 (-31.71%)
Mutual labels:  router
Rnplus
RNX 的前端拓展框架
Stars: ✭ 25 (-39.02%)
Mutual labels:  router
Altair
Lightweight and Robust API Gateway written in Go
Stars: ✭ 34 (-17.07%)
Mutual labels:  router
Jsoo router
A small router to write easily single-page-app in Js_of_ocaml
Stars: ✭ 24 (-41.46%)
Mutual labels:  router
Gt React Scaffold
🥚A boilerplate for client apps of webpack, react, redux, router...
Stars: ✭ 15 (-63.41%)
Mutual labels:  router
Url Mapper
Take a URL and map to functions, parsing params
Stars: ✭ 39 (-4.88%)
Mutual labels:  router
Copper
Copper is a set of Go packages that help you build backend APIs quickly and with less boilerplate.
Stars: ✭ 35 (-14.63%)
Mutual labels:  router
Khala
A URL Router for iOS/macOS, written in Swift
Stars: ✭ 31 (-24.39%)
Mutual labels:  router

Router

Build Status

A micro routing library written in swift, primarily for deep linking use cases

Installation

Embedded frameworks require a minimum deployment target of iOS 8.

Integration can be done either Manually or through Cocoapods

Cocoapods

CocoaPods is a dependency manager for Cocoa projects.

CocoaPods 0.36 adds supports for Swift and embedded frameworks. You can install it with the following command:

$ gem install cocoapods

To integrate Router into your Xcode project using CocoaPods, specify it in your Podfile:

platform :ios, '8.0'
use_frameworks!

pod 'Router', '~> 1.0.0'

Then, run the following command:

$ pod install

Requirements

  • iOS 8.0+
  • Xcode 7.1
  • Swift 2.0
  • Cocoapods 0.36+ (Optional)

Simple Usage

import Router

// create your router
let router = Router()

// bind your routes with a callback
router.bind("/route/:id") { (req) -> Void in
    print(req.param("id")!)
}

// match a route
let url = NSURL(string: "routerapp://route/abc123")!
let route = router.match(url)

Route binding

Bind a closure to a route definition

router.bind("/route/:id") { (req) -> Void in
    print(req.param("id")!)
}

Route Matching

Matches an incoming url to a route in the Router. If a match is made, the closure is executed and the matched route is returned

let url = NSURL(string: "routerapp://route/abc123")!
let route = router.match(url)

Request Object

A request object is accessible in the closure arg. Access url params in the closure (ie. id from /route/:id) by using .param() function

router.bind("/route/:id") { (req) -> Void in
	let id = req.param("id")!
}

Access query string params from the callback (ie. /route/123?foo=bar) by using .query() function

router.bind("/route/:id") { (req) -> Void in
	let foo = req.query("foo")! 
}

Deeplinking to the Sample app

  • Install the RouterExample app
  • Close the app
  • Open safari
  • Type routerapp://route/one into the address bar to access View One
  • Exit out of the app
  • Type routerapp://route/one/abc123 into the address bar to access View Two

Found a bug?

  • Open up an issue
  • Write test(s) that reproduce the issue
  • Fix the issue
  • Send a Pull Request

Want a feature request?

  • Open up an Issue
  • Write test(s) around the new feature
  • Implement the feature
  • Send a Pull Request

License

Licensed under the Apache License, Version 2.0. See LICENSE for details.

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].