Swift generic usage inside class

I have the following class in Swift:

public class EffectModel {
       var type:String
       var keyframeGroup:[Keyframe<EffectParam>] = []
  }

  public enum EffectParam<Value:Codable>:Codable {
      case scalar(Value)
      case keyframes([Keyframe<Value>])

      public enum CodingKeys: String, CodingKey {
         case rawValue, associatedValue
      }
      ...
      ...
}

 public class Keyframe<T:Codable> : Codable {
   public var time:CMTime
   public var property:String
   public var value:T

   enum CodingKeys: String, CodingKey {
     case time
     case property
     case value
   }
   ...
  }

The problem is compiler doesn't accepts the generic EffectParam and gives the error

  Generic parameter 'Value' could not be inferred

One way to solve the problem would be to redeclare the class EffectModel as

  public class EffectModel <EffectParam:Codable>

But the problem is this class has been included in so many other classes so I will need to incorporate generic in every class that has object of type EffectModel, and then any class that uses objects of those classes and so on. That is not a solution for me. Is there any other way to solve the problem in Swift using other language constructs (such as protocols)?

I'm not really sure it will work, but can't you write:

public class EffectModel<Value: Codable> {
       var type : String  // Needs to be initialised in an init()
       var keyframeGroup:[Keyframe<EffectParam<Value>>] = []
  }

What you are trying is not possible in the current type system of Swift. Better do the one way to solve even when you need to modify thousands of lines in your project. (Not exaggerating, assuming less than thousands.) Or else, if you could show very detailed info of the usage of EffectModel especially the property keyframeGroup, there might be other better workarounds. But anyway, you might have to modify EffectModel itself, under the current type system of Swift, no declaration using incomplete generic type like :[Keyframe<EffectParam>] is allowed.

Swift generic usage inside class
 
 
Q