Created
November 26, 2018 12:41
-
-
Save serhatsezer/7141490a8377f42c663e34a186b42e4a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MoyaCacheablePlugin.swift | |
final class MoyaCacheablePlugin: PluginType { | |
func prepare(_ request: URLRequest, target: TargetType) -> URLRequest { | |
if let moyaCachableProtocol = target as? MoyaCacheable { | |
var cachableRequest = request | |
cachableRequest.cachePolicy = moyaCachableProtocol.cachePolicy | |
return cachableRequest | |
} | |
return request | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment