Hi this is really a very good example in swift where abstract factory pattern is well presented. Big thank you for this.

However, I am having slight confusion here:-

  1. I assume JobContactProtocol is an abstract factory and all ios,web QA, etc are the different factoryies which creates different products. I am making this point because in Swift we can’t create abstract class ( unless you create some method with fatalerror) so we usually go by using protocol.
  2. In our case products are different template which is generated by sendRequestResumeEmail()->String which is nothing but smilar to createProduct()->Product
  3. Now, I am really confused with JobContacterFactory which you say is actual factory which returns different factory based on conrete product type. If this is the case then I am wrong at making point (1) where I say “JobContactProtocol is an abstract factory” .

Anything on it will be much appreciated. Thanks in advance.

    Manish Kumar Srivastav

    Written by

    Mobile Tech Lead@iOS, Hooked to Swift, Math Enthusiast