Reference Semantics: Classes are reference types. Multiple references to the same instance can lead to unintended side effects due to shared state, making it harder to track and debug state changes.
Performance: Classes incur additional overhead due to reference counting and heap allocation. Structs, being value types, are usually allocated on the stack, which is faster and more efficient for small, short-lived data.
Mutability: Classes are inherently mutable, which can lead to errors if not carefully managed. Structs are value types and are copied on assignment, ensuring immutability by default unless explicitly marked as mutable.
State Management: JSONDecoder maintains internal state during the decoding process. Using a class allows this state to be managed and modified as needed without copying the entire decoder.
Inheritance and Customization: Classes allow for inheritance, enabling developers to subclass JSONDecoder to add custom behavior or extend functionality, which would not be possible with structs.
so overall it is depend upon what kind of network layer are you building if you want to maintain some kind of state you should use Class otherwise struct
sorry for delayed reply
i hope this is helpful
thanks