• Stars
    star
    1,398
  • Rank 32,323 (Top 0.7 %)
  • Language
    Swift
  • License
    MIT License
  • Created about 9 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Swift HTTP for Humans

Supported Flatform CocoaPods Carthage compatible Build Status

Just is a client-side HTTP library inspired by python-requests - HTTP for Humans.

Features

Just lets you to the following effortlessly:

  • URL queries
  • custom headers
  • form (x-www-form-encoded) / JSON HTTP body
  • redirect control
  • multipart file upload along with form values.
  • basic/digest authentication
  • cookies
  • timeouts
  • synchronous / asynchronous requests
  • upload / download progress tracking for asynchronous requests
  • link headers
  • friendly accessible results

Use

The simplest request with Just looks like this:

//  A simple get request
Just.get("http://httpbin.org/get")

The next example shows how to upload a file along with some data:

//  talk to registration end point
let r = Just.post(
    "http://justiceleauge.org/member/register",
    data: ["username": "barryallen", "password":"ReverseF1ashSucks"],
    files: ["profile_photo": .url(fileURLWithPath:"flash.jpeg", nil)]
)

if r.ok { /* success! */ }

Here's the same example done asynchronously:

//  talk to registration end point
Just.post(
    "http://justiceleauge.org/member/register",
    data: ["username": "barryallen", "password":"ReverseF1ashSucks"],
    files: ["profile_photo": .url(fileURLWithPath:"flash.jpeg", nil)]
) { r in
    if r.ok { /* success! */ }
}

Read Getting Started on the web or in this playground to learn more!

Install

Here are some ways to leverage Just.

Xcode

Add https://github.com/dduan/Just.git the usual way.

Swift Package Manager

Add the following to your dependencies:

.package(url: "https://github.com/dduan/Just.git",  from: "0.8.0")

… and "Just" to your target dependencies.

Carthage

Include the following in your Cartfile:

github "dduan/Just"

Just includes dynamic framework targets for both iOS and OS X.

CocoaPods

The usual way:

platform :ios, '8.0'
use_frameworks!

target 'MyApp' do
  pod 'Just'
end

Manual

Drop Just.xcodeproj into your project navigator. Under the General tab of your project settings, use the plus sign to add Just.framework to Linked Framework and Libraries. Make sure to include the correct version for your target's platform.

It's also common to add Just as a git submodule to your projects repository:

cd path/to/your/project
git submodule add https://github.com/dduan/Just.git

Source File

Put Just.swift directly into your project. Alternately, put it in the Sources folder of a playground. (The latter makes a fun way to explore the web.)

Contribute

Pull requests are welcome. Here are some tips for code contributors:

Work in Just.xcworkspace.

The tests for link headers relies on Github APIs, which has a low per-hour limit. To overcome this, you can edit the Xcode build schemes and add environment variables GITHUB_TOKEN. Learn more about personal tokens here.

For Xcode rebels, checkout Makefile.

HTML documentation pages are generated by literate programmin tool docco

License

MIT, see LICENSE.md.

More Repositories

1

tre

Tree command, improved.
Rust
660
star
2

needless

A utility to find needless words in Swift function names.
Swift
175
star
3

DrString

DrString finds issues in your Swift docstrings and fixes them for you.
Swift
169
star
4

Pathos

File management and path analysis for Swift
Swift
110
star
5

Markra

An open-source Markdown-to-JIRA syntax editor written in SwiftUI for macOS
Swift
92
star
6

Termbox

Swift Wrapper for Termbox: A Lightweight TUI Library
C
66
star
7

TOMLDecoder

From TOML to Swift Codable types.
Swift
63
star
8

git2dayone

A script for logging git commit messages in the app Day One
Shell
39
star
9

DistributionTests

Swift 3 distribution test for open-source libraries.
Makefile
23
star
10

Swift-Framework-Without-Xcode

A sample project to demonstrate how to build and link to Swift frameworks dynamically without using Xcode.
Makefile
22
star
11

Lic

Easy, safe object slicing for Swift
Swift
21
star
12

Tweet-Importer-For-Day-One

Imports Tweet Archive To Day One
Python
21
star
13

dotfiles

Nix
20
star
14

Swipe-Away

An iOS 7 demo of user interaction with UIView achieved via UIDynamics.
Objective-C
17
star
15

cURLLook

Represent your NSURLRequest with a cURL command.
Swift
16
star
16

Comprehension

List Comprehension For Swift
Swift
16
star
17

django-sophie

Just another Django-based blog engine, that runs on GAE.
Python
14
star
18

Clue

Clue is a Swift library, and a command-line tool that finds symbol references in Swift projects.
Swift
14
star
19

ea

ea: make your CLI output actionable.
Rust
13
star
20

BrainAss

A Brainfuck to WebAssembly compiler written in Haskell
Haskell
9
star
21

TerminalPaint

A project that demonstrates how to build a TUI program in Swift
Swift
9
star
22

swift-system-extras

Swift System, battery included.
Swift
9
star
23

Dye

Cross-platform terminal styling for Swift command-line interface.
Swift
8
star
24

NetTime

RFC 3339 compliant date/time data types.
Swift
8
star
25

BitArray

A space-efficient bit array with RandomAccessCollection conformance in Swift.
Swift
5
star
26

Flapcopy

A Flappy Bird inspired HTML5 game.
CoffeeScript
5
star
27

Relay

Stateless alternatives to Combine.Subject
Swift
5
star
28

DrString.vim

Vim integration for DrString
Vim Script
4
star
29

TOMLDeserializer

Replaced by https://github.com/dduan/TOMLDecoder
Swift
4
star
30

IsTTY

Helps you decide whether your file is a terminal device.
Swift
4
star
31

CoverMaker

A small macOS that generates YouTube video thumbnails from metadata, built with SwiftUI and The Composable Architecture
Swift
4
star
32

Factorino

Swift
3
star
33

swift-system-exit

`exit` system call for Swift
Swift
2
star
34

Scmark

Thin, faithful, but Swift-y wrappers for cmark.
C
2
star
35

nixSwiftPM

Nix helper for SwiftPM
Nix
2
star
36

PEG

Parsing Expression Grammar implemented in Swift.
Swift
1
star
37

AllTheSwiftFiles

Fetch all popular Swift files from Github for language feature study
Python
1
star
38

scoop-bucket

Scoop (https://scoop.sh) apps.
1
star
39

herp

Help Extract Real Phrases: A CLI Utility.
Swift
1
star
40

SwiftOnNix

Scripts for generating Nix expression for the Swift toolchain.
Nix
1
star
41

mmm

A interactive CLI helper for manipulating files.
Rust
1
star