Skip to content

jozsef-vesza/Bookshelf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bookshelf

Minimal example app to demo a the techniques below.

Struct-based dependencies

Inspired by Pointfree's course on Designing Dependencies I've decided to move away from a protocol-oriented approach for dependencies, and exposed a simple struct instead.

  • separating interface and implementation can help a lot with build times in larger projects
  • the approach results in less boilerplate, and provides straightforward inline mocking

Enum-based networking

This approach is based on Moya's implementation.

  • enums are a good way to represent a finite number of endpoints
  • the requirements of declaring a remote API are made clear via protocols.

Unit-testing networking code

Instead of wrapping Foundation components in protocols, I've decided to rely on URLProtocol to provide mock responses (based on this article)

Screenshots

About

Demo of enum-based networking approach

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages