Skip to content

Commit

Permalink
Merge pull request #1 from uhooi/feature/create_package
Browse files Browse the repository at this point in the history
Create package
  • Loading branch information
uhooi authored Jul 31, 2021
2 parents c8726ad + 5ac8350 commit 5d18329
Show file tree
Hide file tree
Showing 13 changed files with 368 additions and 88 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

env:
DEVELOPER_DIR: /Applications/Xcode_12.4.app

jobs:
build:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v2
- name: Build
run: swift build -v

test:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v2
- name: Test
run: swift test -v

97 changes: 9 additions & 88 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,90 +1,11 @@
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
.DS_Store
/.build
/Packages
/*.xcodeproj
.swiftpm
.*.sw?

## User settings
xcuserdata/
# Ruby
.ruby-version
vendor

## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
*.xcscmblueprint
*.xccheckout

## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
build/
DerivedData/
*.moved-aside
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3

## Obj-C/Swift specific
*.hmap

## App packaging
*.ipa
*.dSYM.zip
*.dSYM

## Playgrounds
timeline.xctimeline
playground.xcworkspace

# Swift Package Manager
#
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
# Package.pins
# Package.resolved
# *.xcodeproj
#
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
# hence it is not needed unless you have added a package configuration file to your project
# .swiftpm

.build/

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# Pods/
#
# Add this line if you want to avoid checking in source code from the Xcode workspace
# *.xcworkspace

# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts

Carthage/Build/

# Accio dependency management
Dependencies/
.accio/

# fastlane
#
# It is recommended to not store the screenshots in the git repo.
# Instead, use fastlane to re-generate the screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/#source-control

fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots/**/*.png
fastlane/test_output

# Code Injection
#
# After new code Injection tools there's a generated folder /iOSInjectionProject
# https://github.com/johnno1962/injectionforxcode

iOSInjectionProject/
28 changes: 28 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// swift-tools-version:5.3

import PackageDescription

let package = Package(
name: "HTTPClient",
platforms: [
.iOS(.v8),
.macOS(.v10_10),
.tvOS(.v9),
.watchOS(.v2),
],
products: [
.library(
name: "HTTPClient",
targets: ["HTTPClient"]),
],
dependencies: [
],
targets: [
.target(
name: "HTTPClient",
dependencies: []),
.testTarget(
name: "HTTPClientTests",
dependencies: ["HTTPClient"]),
]
)
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,45 @@
# swift-http-client

[![CI](https://github.com/uhooi/swift-http-client/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/uhooi/swift-http-client/actions/workflows/main.yml)
[![Release](https://img.shields.io/github/v/release/uhooi/swift-http-client)](https://github.com/uhooi/swift-http-client/releases/latest)
[![License](https://img.shields.io/github/license/uhooi/swift-http-client)](https://github.com/uhooi/swift-http-client/blob/main/LICENSE)
[![Twitter](https://img.shields.io/twitter/follow/the_uhooi?style=social)](https://twitter.com/the_uhooi)

Communicate via HTTP easily in Swift.

## Table of Contents

- [Installation](#installation)
- [How to use](#how-to-use)
- [Contribution](#contribution)

## Installation

### Swift Package Manager (Recommended)

#### Package

TBD

#### Xcode

TBD

### CocoaPods

TBD

### Carthage

TBD

## How to use

You can just import `HTTPClient` to use it.

## Contribution

I would be happy if you contribute :)

- [New issue](https://github.com/uhooi/swift-http-client/issues/new)
- [New pull request](https://github.com/uhooi/swift-http-client/compare)
4 changes: 4 additions & 0 deletions Sources/HTTPClient/Enums/ContentType.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/// Content-Type.
public enum ContentType: String {
case applicationJson = "application/json"
}
5 changes: 5 additions & 0 deletions Sources/HTTPClient/Enums/HTTPHeaderField.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// HTTP header field.
public enum HTTPHeaderField: String {
case contentType = "Content-Type"
case authorization = "Authorization"
}
6 changes: 6 additions & 0 deletions Sources/HTTPClient/Enums/HTTPMethod.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/// HTTP method.
public enum HTTPMethod: String {
case get = "GET"
case post = "POST"
case put = "PUT"
}
10 changes: 10 additions & 0 deletions Sources/HTTPClient/Enums/RequestError.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/// Request error.
public enum RequestError: Error {
case invalidUrl
case invalidData
case invalidResponse
case redirection(_ statusCode: Int)
case clientError(_ statusCode: Int)
case serverError(_ statusCode: Int)
case invalidStatusCode(_ statusCode: Int)
}
Loading

0 comments on commit 5d18329

Please sign in to comment.