Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rushisangani/networkkit

Testable network layer seamlessly integrating Combine Framework, and Async/Await using Swift Package
https://github.com/rushisangani/networkkit

async-await combine-framework framework ios-network-layer swift swiftpackagemanager

Last synced: about 1 month ago
JSON representation

Testable network layer seamlessly integrating Combine Framework, and Async/Await using Swift Package

Awesome Lists containing this project

README

        

# NetworkKit

iOS app's connectivity with NetworkKit – a simple yet powerful network layer seamlessly integrating Combine Framework, Async/Await, and Unit Tests.

# GitHub Repos

Checkout this sample project [SwiftMVVMDemo](https://github.com/rushisangani/SwiftMVVMDemo).

## Examples

```swift
public protocol NetworkHandler {
func fetch(request: Request) async throws -> T
func fetch(request: Request) -> AnyPublisher
}
```

```swift
import NetworkKit

class PostService: PostRetrievalService {
let networkManager: NetworkHandler

init(networkManager: NetworkHandler = NetworkManager()) {
self.networkManager = networkManager
}

func getPosts() async throws -> [Post] {
try await networkManager.fetch(request: PostRequest.getPosts)
}
}
```

### Installation

Add `NetworkKit` to your project using Swift Package Manager - https://github.com/rushisangani/NetworkKit

## Contributions

Feel free to submit issues or pull requests to enhance the functionality of NetworkKit.

## Connect with Me

Connect with me on [LinkedIn](https://www.linkedin.com/in/rushisangani/) or follow me on [Medium](https://medium.com/@rushisangani).