I'm trying to create a mock as shown below and getting the compile warning. Not sure what I'm doing wrong here. Or perhaps there's a different approach in creating this mock.
protocol Decodable {}
struct Action<D: Decodable> {}
protocol Requestable {
func perform<T: Decodable>(action: Action<T>)
}
class MockRequestable<U: Decodable>: Requestable {
var action: Action<U>!
func perform<T: Decodable>(action: Action<T>) {
self.action = action as? Action<U>
// Warning: Cast from 'Action<T>' to unrelated type 'Action<U>' always fails
}
}