A practical, real-world example showing how to build a complete networking layer using RequestSpec.
This example connects to JSONPlaceholder (a free fake REST API) and demonstrates all the common patterns you'll need when building your own API clients.
- Complete API coverage for 6 resources (Posts, Comments, Albums, Photos, Todos, Users)
- 24+ working examples covering all HTTP methods
- Clean architecture with protocols, services, and models
- Detailed documentation with inline comments and explanations
cd Examples/RequestSpecExample
swift runThat's it! The example will execute all API calls and print the results.
Open RequestSpecExample.swift and explore:
- Lines ~120-395: Example demonstrations
- Lines ~395-590: Service layer architecture
- Lines ~810+: RequestSpec definitions (the good stuff!)
Each request is documented with what it does and why. Perfect for learning by example!
Don't forget to check the request definitions at the bottom to see RequestSpec in action!