Code Monkey home page Code Monkey logo

multipart_data_builder's Introduction

Multipart Data Builder

Build Status CocoaPods Compatible Carthage Compatible

MultipartDataBuilder is a micro framework for creating multipart data forms, used for uploading files over HTTP.

Usage

MultipartDataBuilder provides a simple API for building fields, and an extension on NSMutableURLRequest for attaching the built form and sets the required header.

Creating the multipart form:

var builder = MultipartDataBuilder()

Posting a file:

builder.appendFormData("image",
  content: image,
  fileName: "photo.jpg",
  contentType: "image/jpeg")

Adding other form data:

builder.appendFormData("filter", value: "sepia")

Building the form:

request.setMultipartBody(builder.build(), boundary: builder.boundary)

Install

  1. Add github "mogstad/multipart_data_builder" ~> 2.0 to your “Cartfile”
  2. Run carthage update
  3. Link MultipartDataBuilder with your target
  4. Create a new “Copy files” build phases, set ”Destination” to ”Frameworks”, add MultipartDataBuilder

Update your podfile:

  1. Add use_frameworks! to your pod file1
  2. Add pod "MultipartDataBuilder", "~> 2.0" to your target
  3. Update your dependencies by running pod install

Swift code can’t be included as a static library, therefor it’s required to add use_frameworks! to your podfile. It will then import your dependeices as dynamic frameworks.

Footnotes

multipart_data_builder's People

Contributors

mogstad avatar readmecritic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

multipart_data_builder's Issues

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.