{"id":5225,"date":"2017-08-31T14:46:51","date_gmt":"2017-08-31T14:46:51","guid":{"rendered":"https:\/\/cheesecakelabs.com\/blog\/?p=5225\/"},"modified":"2022-07-01T17:32:49","modified_gmt":"2022-07-01T17:32:49","slug":"ios-architecture-viper-tips","status":"publish","type":"post","link":"https:\/\/cheesecakelabs.com\/blog\/ios-architecture-viper-tips\/","title":{"rendered":"iOS Architectures: Should I use VIPER?"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">If you are familiar with iOS trending topics, you certainly already know VIPER. It\u2019s an alternative to MVC (Model View Controller) pattern and it was already explained in <\/span><a href=\"https:\/\/cheesecakelabs.com\/blog\/blog\/ios-project-architecture-using-viper\/\"><span style=\"font-weight: 400;\">our blog<\/span><\/a><span style=\"font-weight: 400;\">. If you haven&#8217;t read yet, I strongly recommend you to do it.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">There is a lot of content on the web talking about the VIPER miracles and how this new architecture is much better than the previous ones. But you always have to ask some questions before putting your efforts and resources into an &#8220;unknown path&#8221;.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">On this article, I will clarify some questions about the VIPER workflow and if you should be using it on a new project \u2013 or even on your old running app.<\/span><\/p>\n<p><!--more--><\/p>\n<h2><strong>VIPER x MVC<\/strong><\/h2>\n<p><span style=\"font-weight: 400;\">Despite all the critics, Apple&#8217;s MVC architecture is still a great pattern to use. It\u2019s simple, easy, widespread and probably the most reliable architecture to use. All the iOS frameworks are made over the MVC and developing while using this concept is very flowing.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">It&#8217;s a really, really simple architecture with three basic modules, Model, View, and Controller. You don&#8217;t get stuck on questions like <\/span><i><span style=\"font-weight: 400;\">&#8220;Where can I put this code? Interactor? Presenter? Should I pass this to Router?&#8221;.<\/span><\/i><\/p>\n<p><span style=\"font-weight: 400;\">But like Uncle Ben says:<\/span><\/p>\n<blockquote><p>&#8220;&#8230;<span style=\"font-weight: 400;\">with great power comes great responsibility.<\/span>&#8220;<\/p><\/blockquote>\n<p><span style=\"font-weight: 400;\">With all the MVC simplicity, we developers sometimes have to create a massive view controller and that is what VIPER promises to solve and it does extremely well by the way. VIPER is clean: you can look at your code and say <\/span><i><span style=\"font-weight: 400;\">&#8220;well this looks pretty and fancy!&#8221;<\/span><\/i><span style=\"font-weight: 400;\"> and it is indeed an extremely elegant solution.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">But there is a downside: its complexity. For a beginner, it can be confusing and if you don&#8217;t really know what you are doing you can end with more code than you would have with a massive view controller.<\/span><\/p>\n<h2><strong>Bureaucracy<\/strong><\/h2>\n<p><img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/media.giphy.com\/media\/4uQdQbQALrLpu\/giphy.gif\" alt=\"A person screaming because VIPER is too bureaucratic \" width=\"624\" height=\"352\"><\/p>\n<p><span style=\"font-weight: 400;\"><a href=\"https:\/\/developer.apple.com\/library\/content\/documentation\/Swift\/Conceptual\/Swift_Programming_Language\/Protocols.html\">Protocols<\/a>, they are great! Seriously, my work has become so much better since Swift implemented it. Their common use is to define the behaviors of an object and VIPER uses that approach to declare behaviors on its modules.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">But sometimes, all this bureaucracy can get a bit painful. To call a new screen, for example, you have to implement the action handler on your View, create a function on the Presenter, which will simply call the Router\u2019s function to then call your new screen. Besides all that work, you will have to implement the signature of this new functions in the Contract file.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">If you scale that for your entire application, the amount of boilerplate can be massive and not pleasant to be implemented.<\/span><\/p>\n<h2><strong>The dev skills<\/strong><\/h2>\n<p><span style=\"font-weight: 400;\">If you are working on a team, the people that work with you have different sets and levels of skills, right?<\/span><\/p>\n<p><span style=\"font-weight: 400;\">If you have a team composed by devs without a good knowledge of good development practices, architecture, protocol orientation, object orientation, etc \u2013 then maybe implementing VIPER is not a good idea.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">This architecture is a little bit more complicated than MVC, so before you start using it, it\u2019s crucial for your team to have a good acknowledgment in how to build iOS apps, so focus on improving your team&#8217;s skills before.<\/span><\/p>\n<h2><strong>Ramp up time<\/strong><\/h2>\n<p><img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/media.giphy.com\/media\/10PcMWwtZSYk2k\/giphy.gif\" alt=\"Ain't nobody got time for that! (about the ramp up on VIPER)\" width=\"628\" height=\"353\"><\/p>\n<p><span style=\"font-weight: 400;\">Does your project have really, really, short timelines? Keep away of VIPER!<\/span><\/p>\n<p><span style=\"font-weight: 400;\">One of my biggest problems with VIPER is the ramp up. To start a project, you lose a lot of time by setting up the basics. Of course that, with more expertise, your time will decrease But, for your first project with VIPER, choose a project with an environment that you can take time for thinking, testing and implementing.<\/span><\/p>\n<h2><strong>Wrapping up<\/strong><\/h2>\n<p><span style=\"font-weight: 400;\">If you stayed with me until now, you already know the answer to the article title. But if you&#8217;re a quick reader and just want a summary, the answer is: It depends.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Before choosing between VIPER, MVC, or any other architecture you should answer a few questions:<\/span><\/p>\n<ul>\n<li><span style=\"font-weight: 400;\">Is my team open to this new approach?<\/span><\/li>\n<li>What is the level of expertise of my team?<\/li>\n<li>Am I &nbsp;in a hurry with my new project?<\/li>\n<li>Can I &nbsp;afford the cons of this new architecture?<\/li>\n<li>Will this project gonna be big? or become bigger?<\/li>\n<li>And again, is my team REALLY open to this new approach?<\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">If you have more &#8220;nays&#8221; than &#8220;yays&#8221; maybe a good path is learning more about the architecture and implementing it on a personal project, to have a real perception about the implementation.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Always remember: it\u2019s not because a topic is a Hypertrend that is going to fit well with your solution or that it\u2019s better than the one you are currently using.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">That&#8217;s all folks! Have you got any considerations? Questions? Experiences? Share them on comments. See ya!<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you are familiar with iOS trending topics, you certainly already know VIPER. It\u2019s an alternative to MVC (Model View Controller) pattern and it was already explained in our blog. If you haven&#8217;t read yet, I strongly recommend you to do it. There is a lot of content on the web talking about the VIPER [&hellip;]<\/p>\n","protected":false},"author":65,"featured_media":5264,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[432,7],"tags":[305,21],"class_list":["post-5225","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-engineering","category-opinion","tag-tag-development","tag-tag-ios"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>iOS Architectures: Should I use VIPER?<\/title>\n<meta name=\"description\" content=\"We will point some ups and downs using VIPER on a new iOS project and some tips that will help you to choose this architecture among other ones.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/cheesecakelabs.com\/blog\/ios-architecture-viper-tips\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"iOS Architectures: Should I use VIPER?\" \/>\n<meta property=\"og:description\" content=\"We will point some ups and downs using VIPER on a new iOS project and some tips that will help you to choose this architecture among other ones.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cheesecakelabs.com\/blog\/ios-architecture-viper-tips\/\" \/>\n<meta property=\"og:site_name\" content=\"Cheesecake Labs\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/cheesecakelabs\" \/>\n<meta property=\"article:published_time\" content=\"2017-08-31T14:46:51+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-07-01T17:32:49+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2017\/08\/vipershould_banner.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2000\" \/>\n\t<meta property=\"og:image:height\" content=\"720\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Cheesecake Labs\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@cheesecakelabs\" \/>\n<meta name=\"twitter:site\" content=\"@cheesecakelabs\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/ios-architecture-viper-tips\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/ios-architecture-viper-tips\/\"},\"author\":{\"name\":\"Alan Ostanik\"},\"headline\":\"iOS Architectures: Should I use VIPER?\",\"datePublished\":\"2017-08-31T14:46:51+00:00\",\"dateModified\":\"2022-07-01T17:32:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/ios-architecture-viper-tips\/\"},\"wordCount\":802,\"commentCount\":1,\"image\":{\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/ios-architecture-viper-tips\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2017\/08\/vipershould_banner.png\",\"keywords\":[\"development\",\"iOS\"],\"articleSection\":[\"Engineering\",\"Opinion\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/cheesecakelabs.com\/blog\/ios-architecture-viper-tips\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/ios-architecture-viper-tips\/\",\"url\":\"https:\/\/cheesecakelabs.com\/blog\/ios-architecture-viper-tips\/\",\"name\":\"iOS Architectures: Should I use VIPER?\",\"isPartOf\":{\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/ios-architecture-viper-tips\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/ios-architecture-viper-tips\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2017\/08\/vipershould_banner.png\",\"datePublished\":\"2017-08-31T14:46:51+00:00\",\"dateModified\":\"2022-07-01T17:32:49+00:00\",\"author\":{\"@type\":\"person\",\"name\":\"Alan Ostanik\"},\"description\":\"We will point some ups and downs using VIPER on a new iOS project and some tips that will help you to choose this architecture among other ones.\",\"breadcrumb\":{\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/ios-architecture-viper-tips\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/cheesecakelabs.com\/blog\/ios-architecture-viper-tips\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/ios-architecture-viper-tips\/#primaryimage\",\"url\":\"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2017\/08\/vipershould_banner.png\",\"contentUrl\":\"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2017\/08\/vipershould_banner.png\",\"width\":2000,\"height\":720},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/ios-architecture-viper-tips\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/cheesecakelabs.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"iOS Architectures: Should I use VIPER?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/#website\",\"url\":\"https:\/\/cheesecakelabs.com\/blog\/\",\"name\":\"Cheesecake Labs\",\"description\":\"Nearshore outsourcing company for Web and Mobile design and engineering services, and staff augmentation for startups and enterprises..\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/cheesecakelabs.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"name\":\"Alan Ostanik\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2016\/11\/alan3-300x300.jpg\",\"contentUrl\":\"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2016\/11\/alan3-300x300.jpg\",\"caption\":\"Alan Ostanik\"},\"description\":\"10 years of experience in Marketing and Sales in the Technology sector. My main purpose is help, support and structure efficient operations and also develop independent and multidisciplinary teams.\",\"url\":\"https:\/\/cheesecakelabs.com\/blog\/autor\/alan\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"iOS Architectures: Should I use VIPER?","description":"We will point some ups and downs using VIPER on a new iOS project and some tips that will help you to choose this architecture among other ones.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/cheesecakelabs.com\/blog\/ios-architecture-viper-tips\/","og_locale":"en_US","og_type":"article","og_title":"iOS Architectures: Should I use VIPER?","og_description":"We will point some ups and downs using VIPER on a new iOS project and some tips that will help you to choose this architecture among other ones.","og_url":"https:\/\/cheesecakelabs.com\/blog\/ios-architecture-viper-tips\/","og_site_name":"Cheesecake Labs","article_publisher":"https:\/\/www.facebook.com\/cheesecakelabs","article_published_time":"2017-08-31T14:46:51+00:00","article_modified_time":"2022-07-01T17:32:49+00:00","og_image":[{"width":2000,"height":720,"url":"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2017\/08\/vipershould_banner.png","type":"image\/png"}],"author":"Cheesecake Labs","twitter_card":"summary_large_image","twitter_creator":"@cheesecakelabs","twitter_site":"@cheesecakelabs","twitter_misc":{"Written by":null,"Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/cheesecakelabs.com\/blog\/ios-architecture-viper-tips\/#article","isPartOf":{"@id":"https:\/\/cheesecakelabs.com\/blog\/ios-architecture-viper-tips\/"},"author":{"name":"Alan Ostanik"},"headline":"iOS Architectures: Should I use VIPER?","datePublished":"2017-08-31T14:46:51+00:00","dateModified":"2022-07-01T17:32:49+00:00","mainEntityOfPage":{"@id":"https:\/\/cheesecakelabs.com\/blog\/ios-architecture-viper-tips\/"},"wordCount":802,"commentCount":1,"image":{"@id":"https:\/\/cheesecakelabs.com\/blog\/ios-architecture-viper-tips\/#primaryimage"},"thumbnailUrl":"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2017\/08\/vipershould_banner.png","keywords":["development","iOS"],"articleSection":["Engineering","Opinion"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/cheesecakelabs.com\/blog\/ios-architecture-viper-tips\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/cheesecakelabs.com\/blog\/ios-architecture-viper-tips\/","url":"https:\/\/cheesecakelabs.com\/blog\/ios-architecture-viper-tips\/","name":"iOS Architectures: Should I use VIPER?","isPartOf":{"@id":"https:\/\/cheesecakelabs.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/cheesecakelabs.com\/blog\/ios-architecture-viper-tips\/#primaryimage"},"image":{"@id":"https:\/\/cheesecakelabs.com\/blog\/ios-architecture-viper-tips\/#primaryimage"},"thumbnailUrl":"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2017\/08\/vipershould_banner.png","datePublished":"2017-08-31T14:46:51+00:00","dateModified":"2022-07-01T17:32:49+00:00","author":{"@type":"person","name":"Alan Ostanik"},"description":"We will point some ups and downs using VIPER on a new iOS project and some tips that will help you to choose this architecture among other ones.","breadcrumb":{"@id":"https:\/\/cheesecakelabs.com\/blog\/ios-architecture-viper-tips\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cheesecakelabs.com\/blog\/ios-architecture-viper-tips\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cheesecakelabs.com\/blog\/ios-architecture-viper-tips\/#primaryimage","url":"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2017\/08\/vipershould_banner.png","contentUrl":"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2017\/08\/vipershould_banner.png","width":2000,"height":720},{"@type":"BreadcrumbList","@id":"https:\/\/cheesecakelabs.com\/blog\/ios-architecture-viper-tips\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cheesecakelabs.com\/blog\/"},{"@type":"ListItem","position":2,"name":"iOS Architectures: Should I use VIPER?"}]},{"@type":"WebSite","@id":"https:\/\/cheesecakelabs.com\/blog\/#website","url":"https:\/\/cheesecakelabs.com\/blog\/","name":"Cheesecake Labs","description":"Nearshore outsourcing company for Web and Mobile design and engineering services, and staff augmentation for startups and enterprises..","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/cheesecakelabs.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","name":"Alan Ostanik","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cheesecakelabs.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2016\/11\/alan3-300x300.jpg","contentUrl":"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2016\/11\/alan3-300x300.jpg","caption":"Alan Ostanik"},"description":"10 years of experience in Marketing and Sales in the Technology sector. My main purpose is help, support and structure efficient operations and also develop independent and multidisciplinary teams.","url":"https:\/\/cheesecakelabs.com\/blog\/autor\/alan\/"}]}},"_links":{"self":[{"href":"https:\/\/cheesecakelabs.com\/blog\/wp-json\/wp\/v2\/posts\/5225","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cheesecakelabs.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cheesecakelabs.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cheesecakelabs.com\/blog\/wp-json\/wp\/v2\/users\/65"}],"replies":[{"embeddable":true,"href":"https:\/\/cheesecakelabs.com\/blog\/wp-json\/wp\/v2\/comments?post=5225"}],"version-history":[{"count":1,"href":"https:\/\/cheesecakelabs.com\/blog\/wp-json\/wp\/v2\/posts\/5225\/revisions"}],"predecessor-version":[{"id":10271,"href":"https:\/\/cheesecakelabs.com\/blog\/wp-json\/wp\/v2\/posts\/5225\/revisions\/10271"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cheesecakelabs.com\/blog\/wp-json\/wp\/v2\/media\/5264"}],"wp:attachment":[{"href":"https:\/\/cheesecakelabs.com\/blog\/wp-json\/wp\/v2\/media?parent=5225"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cheesecakelabs.com\/blog\/wp-json\/wp\/v2\/categories?post=5225"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cheesecakelabs.com\/blog\/wp-json\/wp\/v2\/tags?post=5225"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}