steamclock / netable

A Swift library for encapsulating network APIs using Codable in a type-oriented way.
MIT License
99 stars 3 forks source link

[92] progress without error #117

Closed amyoulton closed 1 year ago

amyoulton commented 1 year ago

This PR adds in the ability for a request to have a postProcessing method. To implement it, I have done the following:

  1. Added postProcess method to Netable request, that by default returns the FinalResource. This will now be the final method run through every request.
  2. If the user adds a post process method to the request, something can be run before the FinalResource is returned.
  3. I have added in a simple example to the Example project, where we have a Data Manager that stores a user. The GetUserRequest implements the postProcess method, where we send the user to the shared user object in the DataManager before returning the finalResource.
  4. In Homeview, I added a print method to showcase this working.

Note: I also removed the target here for the old example. I think that was also done in the sendable ticket which hasn't been merged, but if not it's done here now! Whichever ticket is merged first, I will rebase the other, so it shouldn't matter.

amyoulton commented 1 year ago

@brendanlensink this is merged! You said you were going to do the tag and release stuff so just nudging about that! 👀