[swift-users] Applying MVC pattern to iOS Swift apps

Adrian Zubarev adrian.zubarev at devandartist.com
Fri Jun 23 04:55:35 CDT 2017

Well you are right this is not the right place for such questions, because this mailing list is about pure Swift topics. 

Think about MVC as MVVM where M = M, V = V and C = VM. Don't get confused by the `Controller` suffix, especially there is no `ViewController` suffix, because it always is and should be view name + controller suffix. That said, a view(controller) is a view and not a ViewModel. For navigation one could extend MVVM with a C for Coordinator (MVVM-C). I just said that you habe to think of MVC as MVVM. If you now apply the extended MVVM-C version backwards you'll get MVC-C, latter naming is confusing right!? ^^

Usually AppDelegate is your main object in your project, except if you need a custom subclass of UIApplication. MVVM-C is a good bullet proof arch. If you try to rethink everything that way you'll quickly notice how you can/should link your objects in such a project. Furthermore you should seperate your business logic completely from everything else, so that is kinda modular. This will help you testing your app and logic better and mantain a good app arch. 

Hopefully I could help you a little.

Adrian Zubarev
Sent with Airmail 

Am 23. Juni 2017 um 11:41:51, Roy Henderson via swift-users (swift-users at swift.org(mailto:swift-users at swift.org)) schrieb:

> Firstly, my apologies for submitting a question which is perhaps not strictly on-topic but hopefully the list will permit me a little latitude.
> Thinking specifically of iOS Swift application design architecture I would be very interested to hear how other members map traditional MVC patterns to the architecture of the standard Xcode templates?
> Should controller functions be incorporated in the AppDelegate or is it better to keep the AppDelegate minimal and put them in a separate controller module?
> Is there any sensible demarcation point regarding which controller functions are acceptable in a ViewController? Does it make better sense to include them in the ViewController most closely associated with their actions or are they better placed in a separate module? In particular, I am trying to avoid breaking the rule regarding never having the V communicate directly with the M.
> I appreciate this is a rather general question with no single right answer. I am happy simply to be pointed towards any guidance documentation which members may be aware of. I have read some of the Apple documentation but have not yet found any definitive answer.
> Thank you,
> Roy
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170623/72dc1bbd/attachment.html>

More information about the swift-users mailing list