Shayokh144 / SurveyApp

0 stars 0 forks source link

[Improvement] Architecture concerns #10

Closed minhnimble closed 2 years ago

minhnimble commented 2 years ago

It is great to see you utilize the VIPER architecture quite well in your code. At the same time, I do have a few small concerns on the following parts that I would love to hear more from you:

Shayokh144 commented 2 years ago

Generic Network Layer

Third party network library

Third party Json Parser

Dependency Injection

after adding dependency injection:

class Router{ static func createModule(view : UIViewController, presenter : Presenter, interactor : Interactor)->UIViewController{

    ........
    .........
}

}



Please let me know your opinion if more improvements can be done here.
minhnimble commented 2 years ago

I think most of the cases of your responses look good to me and I can't wait to see your improvements applied πŸ™. Regarding the following points, I would like to answer to you as follow:

I have used JsonSerializer and JsonDecoder so far. I don't have enough idea about the third party library options. Can you suggest me some names so that I can check. I have very little idea about SwiftyJson.

β†’ I think you misunderstand my question a bit, since my point is mainly about handling JSON:API response format. In case you don't know what it is and why we use it, please feel free to take a look here πŸ™.

At the same time, our provided documentations suggest some iOS libraries for handling JSON:API response here and you probably missed that. πŸ˜…

Anyway, what do you think about updating to use a JSON:API parser instead of doing it manually with Codable like now?

Aprt from Routers , Interactors are also creating networking objects inside their methods. So, in both cases I should add dependency injection.

β†’ Yes, it is correct that besides Router for generating the modules, we can also apply the DI for Interactors layer as well. Your update on the constructor for the Router class is indeed the standard way for decoupling components by providing their dependencies from the outside. πŸ‘

As an additional improvement, you can investigate about using some libraries on iOS for generating the dependencies like Dagger + Hilt or Koin on Android to achieve this. What do you think?

Shayokh144 commented 2 years ago

Dependancy injection is added with a commit. Thanks for the valuable suggestion, I will study these.