NEW: Learn to build the incredible iOS 15 Weather app today! >>

MVC vs MVVM for iOS apps?

Recorded – watch the full episode on YouTube.

Which architecture do you prefer for building iOS apps, MVC or MVVM?

Sean Allen: Yeah, so it's MVC. I've found MVC works 90% of the time, I haven't really explored others. Besides like a basic tutorial, you know what I mean? So take this opinion with a grain of salt, because I don't have full-blown experience in MVVM, and from what I understand and know, MVVM makes your code more easy to test, which we've talked about.

I haven't gone down that road either, so the question to that is, MVC, again, I feel like that's going to work 90% of the time. Most of the time you're using VIPER, MVP, whatever, I feel like you're just shoving that in there when it's unnecessary.

And let me go on this rant real quick, sorry.

“I think MVC's the vast majority of the time going to be perfectly fine. And make your life easier as a team.”

When you get, because MVC is like the norm, right? That's what most developers are going to know. I believe when you try to be clever, and throw in this random architecture, you're also making it hard on new people coming into your team.

I don't know, I think you're trying to be clever for the sake of being clever, for the most part. You got to give that disclaimer, there's absolutely times when those things are necessary, but again, I think MVC's the vast majority of the time going to be perfectly fine. And make your life easier as a team.

“MVC does a fantastic job when implemented correctly and well, and in small chunks. Not like just huge, massive view controllers, but break them out of the view controller. That works brilliant in MVC. There's no need to go much further.”

Paul Hudson: Yes. MVC, for me, is not 90%, it's 100% of the time it will solve the problem perfectly fine in UIKit land. I'd happily work on a project with MVVM – I get that, and it’s cool, but I would not work on a project using VIPER. I would not work on a project using Clean Code. If they were using that, I would say, thanks for the interview folks, but I'm leaving. Because at that point, you're wasting time with being an architecture astronaut, quite frankly; you're not focusing on shipping good code, you're simply focusing on shipping architecture niceties, and that has no interest to me.

MVC does a fantastic job when implemented correctly and well, and in small chunks. Not like just huge, massive view controllers, but break them out of the view controller. That works brilliant in MVC. There's no need to go much further, if you want MVVM, fine, I get that, it's a very nice architecture, testing as you say, not least, but VIPER… I just don't see the point, quite frankly.

This transcript was recorded as part of Swiftly Speaking. You can watch the full original episode on YouTube, or subscribe to the audio version on Apple Podcasts.

Listen on Apple Podcasts

Hacking with Swift is sponsored by Essential Developer

SPONSORED Learn the most up-to-date techniques and strategies for testing new and legacy Swift code in this free practical course for iOS devs who want to become complete Senior iOS Developers.

Learn more

Sponsor Hacking with Swift and reach the world's largest Swift community!

BUY OUR BOOKS
Buy Pro Swift Buy Swift Design Patterns Buy Testing Swift Buy Hacking with iOS Buy Swift Coding Challenges Buy Swift on Sundays Volume One Buy Server-Side Swift (Vapor Edition) Buy Advanced iOS Volume One Buy Advanced iOS Volume Two Buy Advanced iOS Volume Three Buy Hacking with watchOS Buy Hacking with tvOS Buy Hacking with macOS Buy Dive Into SpriteKit Buy Swift in Sixty Seconds Buy Objective-C for Swift Developers Buy Server-Side Swift (Kitura Edition) Buy Beyond Code

Was this page useful? Let us know!

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.