Swiftpack.co - Stampoo/NetworkService as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by Stampoo.
Stampoo/NetworkService 0.1.2
Test network library
⭐️ 0
🕓 2 years ago
.package(url: "https://github.com/Stampoo/NetworkService.git", from: "0.1.2")

NetworkService

While in working

Simple network bicycle:)

Example
  DataTaskProcessor()
      .startTask(url: TestRoute.url, method: .get)
      .decode(on: [String: String].self)
      .perform(in: .main)
      .map(\.count)
      .onComplete { countOfKeys in
          print(countOfKeys)
      }
      .onError { error in
          print(error)
      }
or with Publisher
  @available(iOS 13, *)
  DataTaskProcessor()
      .startTask(url: TestRoute.url, method: .get)
      .publisher
      .compactMap(\.data)
      .decode(type: [String: String].self, decoder: JSONDecoder())
      .sink { result in
         switch result {
         case .finished:
             print("Success!")
         case .failure(let error):
             print("Error \(error.localizedDescription)")
         }
      } receiveValue: { response in
          print(response)
      }
      .store(in: &cancellabelEventsContainer)

GitHub

link
Stars: 0
Last commit: 2 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics