Git Product home page Git Product logo

swiftconnect's Introduction

SwiftConnect

What is SwiftConnect?

SwiftConnect is a lightweight network abstraction layer, built on top of Alamofire. It can be used to dramatically simplify interacting with RESTful JSON web-services.

Table of contents

Requirements

  • iOS 13.0+
  • Xcode 13.2+
  • Swift 5.5+

Installation

SwiftConnect is available through Swift Package Manager To install it, simply add the following line to your Package.swift:

dependencies: [
    .package(url: "https://github.com/tareksabry1337/SwiftConnect.git", .upToNextMajor(from: "3.0.0"))
]

Previous Versions

SwiftConnect has move away from all closure based code and is now completely implemented using Swift's new shiny async / await, if you are still interested in the legacy version that supports iOS 10.0 please refer to the v2 branch instead for the documentation and installation

Support

Please, don't hesitate to file an issue if you have questions.

What's Next ?

  • Unit Testing
  • OAuth2 Support
  • Support for downloading tasks
  • Support for handling refresh tokens.

Dependncies

SwiftConnect doesn't have any depedency except Alamofire

Everything else was built from scratch natively and using Swift's Modern APIs

License

SwiftConnect is available under the MIT license. See the LICENSE file for more info.

swiftconnect's People

Contributors

tareksabry1337 avatar

Stargazers

Soufian Hossam avatar Mohideen Sheik Sulaiman avatar Amr Elghadban avatar Mohamed Abdalla Shera avatar Mustafa Magdy avatar Bassem Tourky avatar Hassan Ramadan avatar Abiú Roldán avatar Sherif Kamal avatar Mohamed AbdElaziz avatar  avatar Ahmed Gamal avatar Hazem Mohamed avatar Ahmed Salem Elzeiny avatar

Watchers

James Cloos avatar Mohideen Sheik Sulaiman avatar  avatar

swiftconnect's Issues

Q: What about 4xx error codes ?

if (200 ..< 300).contains(response.response?.statusCode ?? 0) == false {

Here we do a check if a response is in 200..<300 range or pass nil otherwise.

Some (valid) 4xx HTTP responses might be helpful for upper layer code structures - in terms of taking responsibility of handling them, for example famous 401 Unauthorized. I suggest slightly altering (or expanding) checking error range here, to accommodate handling of such cases.

Also, just encoding the response here would be enough to align with the philosophy to "separate class concerns", in my opinion. Rest of the decision logic of what's "valid or not", shouldn't be responsibility of Connect class. What do you think ?

guard let response = try? JSONSerialization.jsonObject(with: response.data ?? Data(), options: []) as? [String: AnyObject] else { return ConnectError.internalServerError }
return errorHandler.handle(response: response)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.