Skip to content

Commit

Permalink
Merge pull request #40 from steamclock/jc/38-rename-and-consolidate-t…
Browse files Browse the repository at this point in the history
…argets

Rename to Netable, #38, #39
  • Loading branch information
Jeremy Chiang authored Feb 11, 2020
2 parents d95d211 + e9e94b9 commit 76ba700
Show file tree
Hide file tree
Showing 151 changed files with 1,439 additions and 8,303 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,5 @@ fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots/**/*.png
fastlane/test_output

*.DS_Store
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [0.8.0] - 2020-02-07
### Changed
- Renamed library to Netable
- Consolidated iOS and Mac targets to a single target
- Removed MockingJay and updated unit tests using OHHTTPStubs

## [0.7.0] - 2020-02-03
### Added
- Support for Swift Package Manager
Expand Down
13 changes: 13 additions & 0 deletions Netable.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Pod::Spec.new do |s|
s.name = 'Netable'
s.version = '0.8.0'
s.summary = 'A simple and swifty networking library.'
s.description = 'Netable is a simple Swift framework for working with both simple and non-REST-compliant HTTP endpoints.'
s.homepage = 'https://github.com/steamclock/networkAPI/'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'Brendan Lensink' => '[email protected]' }
s.source = { :git => 'https://github.com/steamclock/networkAPI.git', :tag => 'v0.8.0' }
s.ios.deployment_target = '12.0'
s.osx.deployment_target = '10.14'
s.source_files = 'Netable/Netable/*.{swift,h,m}'
end
731 changes: 731 additions & 0 deletions Netable/Netable.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"object": {
"pins": [
{
"package": "OHHTTPStubs",
"repositoryURL": "https://github.com/AliSoftware/OHHTTPStubs.git",
"state": {
"branch": null,
"revision": "e92b5a5746ef16add2a1424f1fc19529d9a75cde",
"version": "9.0.0"
}
}
]
},
"version": 1
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1110"
LastUpgradeVersion = "1130"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -14,10 +14,10 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B354625A217A465100FC442C"
BuildableName = "SCNetworkAPI.framework"
BlueprintName = "SCNetworkAPIMobile"
ReferencedContainer = "container:SCNetworkAPI.xcodeproj">
BlueprintIdentifier = "B8C9287F23E9F68000DB2B37"
BuildableName = "Netable.framework"
BlueprintName = "Netable"
ReferencedContainer = "container:Netable.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
Expand All @@ -32,10 +32,10 @@
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B3546263217A465100FC442C"
BuildableName = "SCNetworkAPIMobileTests.xctest"
BlueprintName = "SCNetworkAPIMobileTests"
ReferencedContainer = "container:SCNetworkAPI.xcodeproj">
BlueprintIdentifier = "B8C9288823E9F68000DB2B37"
BuildableName = "NetableTests.xctest"
BlueprintName = "NetableTests"
ReferencedContainer = "container:Netable.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
Expand All @@ -60,10 +60,10 @@
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B354625A217A465100FC442C"
BuildableName = "SCNetworkAPI.framework"
BlueprintName = "SCNetworkAPIMobile"
ReferencedContainer = "container:SCNetworkAPI.xcodeproj">
BlueprintIdentifier = "B8C9287F23E9F68000DB2B37"
BuildableName = "Netable.framework"
BlueprintName = "Netable"
ReferencedContainer = "container:Netable.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1110"
LastUpgradeVersion = "1130"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -14,10 +14,10 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B3EE1131217A6B930063634A"
BuildableName = "SCNetworkExample.app"
BlueprintName = "SCNetworkExample"
ReferencedContainer = "container:SCNetworkAPI.xcodeproj">
BlueprintIdentifier = "B822C8EA23F20E8900D7BDAD"
BuildableName = "NetableExample.app"
BlueprintName = "NetableExample"
ReferencedContainer = "container:Netable.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
Expand All @@ -44,10 +44,10 @@
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B3EE1131217A6B930063634A"
BuildableName = "SCNetworkExample.app"
BlueprintName = "SCNetworkExample"
ReferencedContainer = "container:SCNetworkAPI.xcodeproj">
BlueprintIdentifier = "B822C8EA23F20E8900D7BDAD"
BuildableName = "NetableExample.app"
BlueprintName = "NetableExample"
ReferencedContainer = "container:Netable.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
Expand All @@ -61,10 +61,10 @@
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B3EE1131217A6B930063634A"
BuildableName = "SCNetworkExample.app"
BlueprintName = "SCNetworkExample"
ReferencedContainer = "container:SCNetworkAPI.xcodeproj">
BlueprintIdentifier = "B822C8EA23F20E8900D7BDAD"
BuildableName = "NetableExample.app"
BlueprintName = "NetableExample"
ReferencedContainer = "container:Netable.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
Expand Down
73 changes: 73 additions & 0 deletions Netable/Netable/Error.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
//
// Error.swift
// Netable
//
// Created by Jeremy Chiang on 2019-04-08.
// Copyright © 2018 steamclock. All rights reserved.
//

import Foundation

public enum NetableError: Error {
case codingError(String)
case decodingError(Error, Data?)
case httpError(Int, Data?)
case malformedURL
case requestFailed(Error)
case wrongServer
case noData
case resourceExtractionError(String)
case unknownError(Error)
}

extension NetableError: LocalizedError {
public var errorDescription: String? {
switch self {
case .codingError(let message):
return "Coding error: \(message)"
case .decodingError(let error, _):
return "Decoding error: \(error.localizedDescription)"
case .httpError(let statusCode, _):
return "HTTP status code: \(statusCode)"
case .malformedURL:
return "Malformed URL"
case .requestFailed(let error):
return "Request failed: \(error.localizedDescription)"
case .wrongServer:
return "Wrong server"
case .noData:
return "No data"
case .resourceExtractionError(let message):
return "Resource Extraction Error: The raw result could not be turned into the final resource: \(message)"
case .unknownError(let error):
return "Unknown error: \(error.localizedDescription)"
}
}
}

extension NetableError: Equatable {
public static func == (lhs: NetableError, rhs: NetableError) -> Bool {
switch (lhs, rhs) {
case (.codingError(let lhsMessage), .codingError(let rhsMessage)):
return lhsMessage == rhsMessage
case (.decodingError(let lhsError, let lhsData), .decodingError(let rhsError, let rhsData)):
return lhsError.localizedDescription == rhsError.localizedDescription && lhsData == rhsData
case (.httpError(let lhsCode, let lhsData), .httpError(let rhsCode, let rhsData)):
return lhsCode == rhsCode && lhsData == rhsData
case (.malformedURL, .malformedURL):
return true
case (.requestFailed(let lhsError), .requestFailed(let rhsError)):
return lhsError.localizedDescription == rhsError.localizedDescription
case (.wrongServer, .wrongServer):
return true
case (.noData, .noData):
return true
case (.resourceExtractionError(let lhsMessage), .resourceExtractionError(let rhsMessage)):
return lhsMessage == rhsMessage
case (.unknownError(let lhsError), .unknownError(let rhsError)):
return lhsError.localizedDescription == rhsError.localizedDescription
default:
return false
}
}
}
16 changes: 16 additions & 0 deletions Netable/Netable/HTTPMethod.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// HTTPMethod.swift
// Netable
//
// Created by Jeremy Chiang on 2020-02-04.
// Copyright © 2020 Steamclock Software. All rights reserved.
//

import Foundation

public enum HTTPMethod: String {
case get = "GET"
case post = "POST"
case put = "PUT"
case patch = "PATCH"
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
Expand Down
19 changes: 19 additions & 0 deletions Netable/Netable/Netable.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// Netable.h
// Netable
//
// Created by Jeremy Chiang on 2020-02-04.
// Copyright © 2020 Steamclock Software. All rights reserved.
//

#import <Foundation/Foundation.h>

//! Project version number for Netable.
FOUNDATION_EXPORT double NetableVersionNumber;

//! Project version string for Netable.
FOUNDATION_EXPORT const unsigned char NetableVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <Netable/PublicHeader.h>


Loading

0 comments on commit 76ba700

Please sign in to comment.