Skip to content

Commit fce44f0

Browse files
committed
Swift concurrency.
1 parent 36d05c9 commit fce44f0

31 files changed

Lines changed: 605 additions & 627 deletions

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
#
33
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
44

5+
## OS X temporary files that should never be committed
6+
.DS_Store
7+
58
## User settings
69
xcuserdata/
710

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2022 Denis Libit
3+
Copyright (c) 2023 Denis Libit
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Package.resolved

Lines changed: 0 additions & 16 deletions
This file was deleted.

Package.swift

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,20 @@ let package = Package(
66
name: "Server",
77
defaultLocalization: "en",
88
platforms: [
9-
.iOS(.v12),
10-
.macOS(.v10_14),
11-
.tvOS(.v12),
12-
.watchOS(.v5),
9+
.iOS(.v15),
10+
.macOS(.v10_15),
11+
.tvOS(.v13),
12+
.watchOS(.v6),
1313
],
1414
products: [
1515
.library(
1616
name: "Server",
1717
targets: ["Server"]
1818
),
1919
],
20-
dependencies: [
21-
.package(
22-
url: "https://github.com/ReactiveCocoa/ReactiveSwift.git",
23-
.init(6, 0, 0) ... .init(99, 0, 0)
24-
),
25-
],
2620
targets: [
2721
.target(
28-
name: "Server",
29-
dependencies: [
30-
"ReactiveSwift",
31-
]
22+
name: "Server"
3223
),
3324
]
3425
)

README.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Server
22

3-
Lightweight ReactiveSwift dynamically configurable network layer.
3+
Asynchronous Swift dynamically configurable network layer.
44

55
## Overview
66

@@ -20,27 +20,27 @@ Server.back
2020
Or as complex as:
2121

2222
```swift
23-
Server.back
24-
.request(
25-
type: .post,
26-
path: "/userinfo",
27-
query: [
28-
"id": userID,
29-
],
30-
send: .multipart([
31-
.png(avatarImage, name: "avatar", filename: "avatar.png"),
32-
.text(firstName, name: "first_name"),
33-
.text(lastName, name: "last_name"),
34-
]),
35-
take: .json(UserCard.self)
36-
)
37-
.reportError(title: "Can't update user card")
38-
.observe(on: QueueScheduler.main)
39-
.startWithValues { userCard in
40-
// process updated user card
41-
}
23+
let userCard =
24+
try await Server.back
25+
.request(
26+
type: .post,
27+
path: "/userinfo",
28+
query: [
29+
"id": userID,
30+
],
31+
send: .multipart([
32+
.png(avatarImage, name: "avatar", filename: "avatar.png"),
33+
.text(firstName, name: "first_name"),
34+
.text(lastName, name: "last_name"),
35+
]),
36+
take: .json(UserCard.self)
37+
)
4238
```
4339

40+
## ReactiveSwift version
41+
42+
ReactiveSwift-flavored Server package is archived in the [reactiveswift](https://github.com/bteapot/Server/tree/reactiveswift) branch and can be referenced by version tags 1.0.x.
43+
4444
## Documentation
4545

4646
Complete Xcode documentation is included with code and its archived version attached to GitHub release page.

Sources/Server/Config.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
//
22
// Config.swift
3-
//
3+
// Server
44
//
55
// Created by Денис Либит on 11.02.2022.
66
//
77

88
import Foundation
9-
import ReactiveSwift
109

1110

1211
extension Server {
@@ -102,7 +101,7 @@ extension Server {
102101
case handle(Check)
103102

104103
public typealias Describe = (Config, URLRequest, HTTPURLResponse, Data) -> String
105-
public typealias Check = (Config, URLRequest, URLResponse, Data) throws -> Void
104+
public typealias Check = (Config, URLRequest, URLResponse, Data) async throws -> Void
106105
}
107106

108107
public typealias Catcher = (Error) -> Error?

Sources/Server/Delegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//
22
// Delegate.swift
3-
//
3+
// Server
44
//
55
// Created by Денис Либит on 11.02.2022.
66
//

Sources/Server/Errors.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//
22
// Errors.swift
3-
//
3+
// Server
44
//
55
// Created by Денис Либит on 11.02.2022.
66
//

Sources/Server/Method.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//
22
// Method.swift
3-
//
3+
// Server
44
//
55
// Created by Денис Либит on 11.02.2022.
66
//

Sources/Server/Reachability.swift

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)