I know this question can be considered as "too broad", but if some of experts can give me the idea or guidance about this question then it will be very helpful to decide which design paradigms I should use ?

I have created number of projects in OOP, as I watch and come through POP, I got understandings that we can achieve what class can do by replacing it with combination of Struct and Protocol.

And as I go through WWDC event video, they quoted "Do not start with class, start with protocol", I also go through examples and tutorials

But yet it is not very much clear when to use Struct or class. As some of the times we need to use Class.

To more elaborate the question,

Consider an example app : In which I have to call web service, Get Data, convert them into Models, Bind them in UI. The basic simple app which we developed in iOS. So for this What approach should I use ?

To clear my understandings I also go through open source swift apps source codes but in that most of the times they have used the Classes.

So In which cases we should use **Classes instead of Struct and Protocol. ?**

As I get know POP is very helpful to reduce duplicate codes and make code Bug free when we are dealing with Multi-threading.

It will be very helpful if someone can help me out to understand this more clearly.

As mentioned in comments (Thank you for this link) This answer give me sufficient information about Struct and Swift.

But another part of my question is which design pattern should be used if any developer trying to develop app in swift.

I go through so many open sources and tutorials, and all places I found they have used Classes. Some more guidance will be very helpful on this topic.

0

There are 0 best solutions below