Skip to content
This repository was archived by the owner on Oct 29, 2021. It is now read-only.

Commit ed2f949

Browse files
committed
Release 0.2.2 with Kommander
1 parent 71e97c2 commit ed2f949

File tree

79 files changed

+3782
-1324
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+3782
-1324
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Release 0.2.2
2+
3+
- [x] [Kommander](https://github.com/intelygenz/Kommander-iOS) Compatible
4+
15
# Release 0.2.1
26

37
- [x] TLS Certificate and Public Key Pinning

Example/ViewController.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99
import UIKit
1010
import Net
1111
import Moya
12+
import Kommander
1213

1314
class ViewController: UIViewController {
1415

1516
let net: Net = NetURLSession()
17+
let kommander = Kommander()
1618

1719
override func viewDidLoad() {
1820
super.viewDidLoad()
@@ -52,6 +54,13 @@ class ViewController: UIViewController {
5254
print(error)
5355
}
5456
}
57+
58+
// Kommander
59+
net.data(request).execute(by: kommander, onSuccess: { object in
60+
print(object)
61+
}) { error in
62+
print("Error: \((error as! NetError).localizedDescription)")
63+
}
5564
}
5665

5766
}

Kommander/NetTask+Kommander.swift

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//
2+
// NetTask+Kommander.swift
3+
// Net
4+
//
5+
// Created by Alex Rupérez on 17/8/17.
6+
//
7+
//
8+
9+
import Kommander
10+
11+
extension NetTask {
12+
13+
/// Execute NetTask
14+
@discardableResult open func execute<T>(by kommander: Kommander, after delay: DispatchTimeInterval? = nil, onSuccess: ((_ result: T) -> Void)?, onError: ((_ error: Error?) -> Void)?) -> Kommand<T> {
15+
let kommand = kommander.makeKommand {
16+
return try self.sync().object()
17+
}.onSuccess { result in
18+
onSuccess?(result)
19+
}.onError { error in
20+
onError?(error)
21+
}
22+
if let delay = delay {
23+
kommand.execute(after: delay)
24+
} else {
25+
kommand.execute()
26+
}
27+
return kommand
28+
}
29+
30+
}

Net.xcodeproj/project.pbxproj

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@
8787
D523AB141E88417E0093D793 /* NetAuthorization.swift in Sources */ = {isa = PBXBuildFile; fileRef = D523AB121E88417E0093D793 /* NetAuthorization.swift */; };
8888
D523AB151E88417E0093D793 /* NetAuthorization.swift in Sources */ = {isa = PBXBuildFile; fileRef = D523AB121E88417E0093D793 /* NetAuthorization.swift */; };
8989
D523AB161E88417E0093D793 /* NetAuthorization.swift in Sources */ = {isa = PBXBuildFile; fileRef = D523AB121E88417E0093D793 /* NetAuthorization.swift */; };
90+
D52FB2671F4583CA00BEE37C /* NetTask+Kommander.swift in Sources */ = {isa = PBXBuildFile; fileRef = D52FB2661F4583CA00BEE37C /* NetTask+Kommander.swift */; };
91+
D52FB2681F4583CA00BEE37C /* NetTask+Kommander.swift in Sources */ = {isa = PBXBuildFile; fileRef = D52FB2661F4583CA00BEE37C /* NetTask+Kommander.swift */; };
92+
D52FB2691F4583CA00BEE37C /* NetTask+Kommander.swift in Sources */ = {isa = PBXBuildFile; fileRef = D52FB2661F4583CA00BEE37C /* NetTask+Kommander.swift */; };
93+
D52FB26A1F4583CA00BEE37C /* NetTask+Kommander.swift in Sources */ = {isa = PBXBuildFile; fileRef = D52FB2661F4583CA00BEE37C /* NetTask+Kommander.swift */; };
9094
D5468BE51EAD3C5E00E1354D /* NetRequest+URLRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5468BE41EAD3C5E00E1354D /* NetRequest+URLRequest.swift */; };
9195
D5468BE61EAD3C5E00E1354D /* NetRequest+URLRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5468BE41EAD3C5E00E1354D /* NetRequest+URLRequest.swift */; };
9296
D5468BE71EAD3C5E00E1354D /* NetRequest+URLRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5468BE41EAD3C5E00E1354D /* NetRequest+URLRequest.swift */; };
@@ -293,6 +297,7 @@
293297
D523AB031E867B480093D793 /* NetTaskMetrics.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetTaskMetrics.swift; sourceTree = "<group>"; };
294298
D523AB0D1E8710D30093D793 /* NetRequest+Build.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NetRequest+Build.swift"; sourceTree = "<group>"; };
295299
D523AB121E88417E0093D793 /* NetAuthorization.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetAuthorization.swift; sourceTree = "<group>"; };
300+
D52FB2661F4583CA00BEE37C /* NetTask+Kommander.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NetTask+Kommander.swift"; sourceTree = "<group>"; };
296301
D5468BE41EAD3C5E00E1354D /* NetRequest+URLRequest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NetRequest+URLRequest.swift"; sourceTree = "<group>"; };
297302
D5468BE91EAD3CAF00E1354D /* NetResponse+Cached​URLResponse.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NetResponse+Cached​URLResponse.swift"; sourceTree = "<group>"; };
298303
D5468BF11EAD3D1E00E1354D /* NetTask+URLSessionTask.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NetTask+URLSessionTask.swift"; sourceTree = "<group>"; };
@@ -441,6 +446,14 @@
441446
name = Pods;
442447
sourceTree = "<group>";
443448
};
449+
D52FB2651F45833C00BEE37C /* Kommander */ = {
450+
isa = PBXGroup;
451+
children = (
452+
D52FB2661F4583CA00BEE37C /* NetTask+Kommander.swift */,
453+
);
454+
path = Kommander;
455+
sourceTree = "<group>";
456+
};
444457
D5468BEE1EAD3D1E00E1354D /* URLSession */ = {
445458
isa = PBXGroup;
446459
children = (
@@ -484,6 +497,7 @@
484497
D5468BEE1EAD3D1E00E1354D /* URLSession */,
485498
D579EE0E1EAE3AC800A2F311 /* Alamofire */,
486499
D579EE0F1EAE3AC800A2F311 /* Moya */,
500+
D52FB2651F45833C00BEE37C /* Kommander */,
487501
81ACB8011E85443F006D05DD /* Tests */,
488502
D5A521CC1E7B348100406F0F /* Example */,
489503
D5A521E11E7B348100406F0F /* ExampleUITests */,
@@ -910,12 +924,14 @@
910924
inputPaths = (
911925
"${SRCROOT}/Pods/Target Support Files/Pods-Tests/Pods-Tests-frameworks.sh",
912926
"${BUILT_PRODUCTS_DIR}/Alamofire-iOS8.0/Alamofire.framework",
927+
"${BUILT_PRODUCTS_DIR}/Kommander-iOS8.0/Kommander.framework",
913928
"${BUILT_PRODUCTS_DIR}/Moya-iOS8.0/Moya.framework",
914929
"${BUILT_PRODUCTS_DIR}/Result-iOS8.0/Result.framework",
915930
);
916931
name = "[CP] Embed Pods Frameworks";
917932
outputPaths = (
918933
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Alamofire.framework",
934+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Kommander.framework",
919935
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Moya.framework",
920936
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Result.framework",
921937
);
@@ -1013,12 +1029,14 @@
10131029
inputPaths = (
10141030
"${SRCROOT}/Pods/Target Support Files/Pods-Example/Pods-Example-frameworks.sh",
10151031
"${BUILT_PRODUCTS_DIR}/Alamofire-iOS8.0/Alamofire.framework",
1032+
"${BUILT_PRODUCTS_DIR}/Kommander-iOS8.0/Kommander.framework",
10161033
"${BUILT_PRODUCTS_DIR}/Moya-iOS8.0/Moya.framework",
10171034
"${BUILT_PRODUCTS_DIR}/Result-iOS8.0/Result.framework",
10181035
);
10191036
name = "[CP] Embed Pods Frameworks";
10201037
outputPaths = (
10211038
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Alamofire.framework",
1039+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Kommander.framework",
10221040
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Moya.framework",
10231041
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Result.framework",
10241042
);
@@ -1050,12 +1068,14 @@
10501068
inputPaths = (
10511069
"${SRCROOT}/Pods/Target Support Files/Pods-ExampleUITests/Pods-ExampleUITests-frameworks.sh",
10521070
"${BUILT_PRODUCTS_DIR}/Alamofire-iOS9.0/Alamofire.framework",
1071+
"${BUILT_PRODUCTS_DIR}/Kommander-iOS9.0/Kommander.framework",
10531072
"${BUILT_PRODUCTS_DIR}/Moya-iOS9.0/Moya.framework",
10541073
"${BUILT_PRODUCTS_DIR}/Result-iOS9.0/Result.framework",
10551074
);
10561075
name = "[CP] Embed Pods Frameworks";
10571076
outputPaths = (
10581077
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Alamofire.framework",
1078+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Kommander.framework",
10591079
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Moya.framework",
10601080
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Result.framework",
10611081
);
@@ -1189,6 +1209,7 @@
11891209
buildActionMask = 2147483647;
11901210
files = (
11911211
D579EE111EAE3AF500A2F311 /* NetAlamofire.swift in Sources */,
1212+
D52FB2671F4583CA00BEE37C /* NetTask+Kommander.swift in Sources */,
11921213
818FC9341E82C26200FEC5A3 /* NetResponse.swift in Sources */,
11931214
81D1C30E1EAF965C008DB282 /* NetReachability.swift in Sources */,
11941215
D579EE301EAE7E3200A2F311 /* NetAlamofire+Download.swift in Sources */,
@@ -1239,6 +1260,7 @@
12391260
buildActionMask = 2147483647;
12401261
files = (
12411262
D579EE121EAE3AF500A2F311 /* NetAlamofire.swift in Sources */,
1263+
D52FB2681F4583CA00BEE37C /* NetTask+Kommander.swift in Sources */,
12421264
818FC9351E82C26300FEC5A3 /* NetResponse.swift in Sources */,
12431265
81D1C30F1EAF965C008DB282 /* NetReachability.swift in Sources */,
12441266
D579EE311EAE7E3200A2F311 /* NetAlamofire+Download.swift in Sources */,
@@ -1281,6 +1303,7 @@
12811303
buildActionMask = 2147483647;
12821304
files = (
12831305
D579EE131EAE3AF500A2F311 /* NetAlamofire.swift in Sources */,
1306+
D52FB2691F4583CA00BEE37C /* NetTask+Kommander.swift in Sources */,
12841307
818FC9361E82C26400FEC5A3 /* NetResponse.swift in Sources */,
12851308
81D1C3101EAF965C008DB282 /* NetReachability.swift in Sources */,
12861309
D579EE321EAE7E3200A2F311 /* NetAlamofire+Download.swift in Sources */,
@@ -1323,6 +1346,7 @@
13231346
buildActionMask = 2147483647;
13241347
files = (
13251348
D579EE141EAE3AF500A2F311 /* NetAlamofire.swift in Sources */,
1349+
D52FB26A1F4583CA00BEE37C /* NetTask+Kommander.swift in Sources */,
13261350
818FC9371E82C26400FEC5A3 /* NetResponse.swift in Sources */,
13271351
81D1C3111EAF965C008DB282 /* NetReachability.swift in Sources */,
13281352
D579EE331EAE7E3200A2F311 /* NetAlamofire+Download.swift in Sources */,
@@ -1467,7 +1491,7 @@
14671491
CURRENT_PROJECT_VERSION = "$(DYLIB_CURRENT_VERSION)";
14681492
DEVELOPMENT_TEAM = 3VW789WSMP;
14691493
DYLIB_COMPATIBILITY_VERSION = 0.2.0;
1470-
DYLIB_CURRENT_VERSION = 0.2.1;
1494+
DYLIB_CURRENT_VERSION = 0.2.2;
14711495
ENABLE_STRICT_OBJC_MSGSEND = YES;
14721496
ENABLE_TESTABILITY = YES;
14731497
GCC_C_LANGUAGE_STANDARD = gnu99;
@@ -1520,7 +1544,7 @@
15201544
CURRENT_PROJECT_VERSION = "$(DYLIB_CURRENT_VERSION)";
15211545
DEVELOPMENT_TEAM = 3VW789WSMP;
15221546
DYLIB_COMPATIBILITY_VERSION = 0.2.0;
1523-
DYLIB_CURRENT_VERSION = 0.2.1;
1547+
DYLIB_CURRENT_VERSION = 0.2.2;
15241548
ENABLE_STRICT_OBJC_MSGSEND = YES;
15251549
GCC_C_LANGUAGE_STANDARD = gnu99;
15261550
GCC_NO_COMMON_BLOCKS = YES;

NetClient.podspec

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'NetClient'
3-
s.version = '0.2.1'
3+
s.version = '0.2.2'
44
s.summary = 'Versatile HTTP networking library written in Swift 3.'
55

66
s.homepage = 'https://github.com/intelygenz/NetClient-iOS'
@@ -40,4 +40,10 @@ Pod::Spec.new do |s|
4040
ss.dependency 'Moya', '~> 8.0'
4141
ss.source_files = "Moya/*.{h,swift}"
4242
end
43+
44+
s.subspec 'Kommander' do |ss|
45+
ss.dependency 'NetClient/URLSession'
46+
ss.dependency 'Kommander', '~> 0.7'
47+
ss.source_files = "Kommander/*.{h,swift}"
48+
end
4349
end

Podfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,40 +5,47 @@ target 'Example' do
55
platform :ios, '8.0'
66
pod 'Alamofire'
77
pod 'Moya'
8+
pod 'Kommander'
89
end
910

1011
target 'ExampleUITests' do
1112
platform :ios, '9.0'
1213
pod 'Alamofire'
1314
pod 'Moya'
15+
pod 'Kommander'
1416
end
1517

1618
target 'Tests' do
1719
platform :ios, '8.0'
1820
pod 'Alamofire'
1921
pod 'Moya'
22+
pod 'Kommander'
2023
end
2124

2225
target 'iOS' do
2326
platform :ios, '8.0'
2427
pod 'Alamofire'
2528
pod 'Moya'
29+
pod 'Kommander'
2630
end
2731

2832
target 'watchOS' do
2933
platform :watchos, '2.0'
3034
pod 'Alamofire'
3135
pod 'Moya'
36+
pod 'Kommander'
3237
end
3338

3439
target 'tvOS' do
3540
platform :tvos, '9.0'
3641
pod 'Alamofire'
3742
pod 'Moya'
43+
pod 'Kommander'
3844
end
3945

4046
target 'macOS' do
4147
platform :osx, '10.10'
4248
pod 'Alamofire'
4349
pod 'Moya'
50+
pod 'Kommander'
4451
end

Podfile.lock

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
PODS:
22
- Alamofire (4.5.0)
3+
- Kommander (0.7.0)
34
- Moya (8.0.5):
45
- Moya/Core (= 8.0.5)
56
- Moya/Core (8.0.5):
@@ -9,13 +10,15 @@ PODS:
910

1011
DEPENDENCIES:
1112
- Alamofire
13+
- Kommander
1214
- Moya
1315

1416
SPEC CHECKSUMS:
1517
Alamofire: f28cdffd29de33a7bfa022cbd63ae95a27fae140
18+
Kommander: 92d901e805c5d820d13e690d95e28bfb168a7c9a
1619
Moya: c37eec09a098ba9991b5a963b291fc5704bdb9ef
1720
Result: 128640a6347e8d2ae48b142556739a2d13f90ce6
1821

19-
PODFILE CHECKSUM: 5e3bea6445aae218fe24600e6cf2473471544f6d
22+
PODFILE CHECKSUM: bf3c3cac92f7f281ea819a99ccae13f53203a80d
2023

2124
COCOAPODS: 1.3.1

Pods/Kommander/LICENSE

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)