Giter VIP home page Giter VIP logo

uritemplate.swift's Introduction

URITemplate

Swift implementation of URI Template (RFC6570).

Installation

CocoaPods is the recommended installation method.

pod 'URITemplate'

Example

Expanding a URI Template

let template = URITemplate(template: "https://api.github.com/repos/{owner}/{repo}/")
let url = template.expand(["owner": "kylef", "repo": "URITemplate.swift"])
=> "https://api.github.com/repos/kylef/URITemplate.swift/"

Determine which variables are in a template

let variables = template.variables
=> ["owner", "repo"]

Extract the variables used in a given URL

let variables = template.extract("https://api.github.com/repos/kylef/PathKit/")
=> ["owner":"kylef", "repo":"PathKit"]

RFC6570

The URITemplate library follows the test suite.

We have full support for level 4 of RFC6570 when expanding a template and retrieving the variables in a template.

For extraction of variables from an already expanded template, level 3 is supported.

License

URITemplate is licensed under the MIT license. See LICENSE for more info.

uritemplate.swift's People

Contributors

damuellen avatar kellydun avatar kylef avatar neonichu avatar paulyoung avatar sauliusgrigaitis avatar zachwaugh 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.