{"id":2644,"date":"2016-04-28T19:11:58","date_gmt":"2016-04-28T19:11:58","guid":{"rendered":"http:\/\/www.ckl.io\/?p=2644"},"modified":"2022-07-01T17:59:13","modified_gmt":"2022-07-01T17:59:13","slug":"ios-project-architecture-using-viper","status":"publish","type":"post","link":"https:\/\/cheesecakelabs.com\/blog\/ios-project-architecture-using-viper\/","title":{"rendered":"iOS Project Architecture: Using VIPER"},"content":{"rendered":"<p>When developing an iOS app, it&#8217;s important to think about what&nbsp;iOS project architecture you should use. Most developers use the pattern&nbsp;<a href=\"https:\/\/developer.apple.com\/library\/ios\/documentation\/General\/Conceptual\/DevPedia-CocoaCore\/MVC.html\">suggested by Apple<\/a>: the so-called MVC (Model-View-Controller) architecture. However, as well-established as it is, the MVC has its flaws. &nbsp;For one, because of its simplicity, it leads even the most experienced engineers&nbsp;to put&nbsp;any code that doesn&#8217;t belong to a View nor to a Model in the Controller&#8217;s logic \u2013&nbsp;generating huge chunks of code in the controller&nbsp;and really compact&nbsp;views and models.<\/p>\n<p>In this post, we&#8217;ll present VIPER, one of the trending alternatives to MVC that might help you overcome its limitations while keeping your code modular and well-organized, improving your development process.<\/p>\n<p><!--more--><\/p>\n<h2>1. What is VIPER?<\/h2>\n<p>VIPER is a backronym for View, Interactor, Presenter, Entity and Router. It&#8217;s basically an approach&nbsp;that implements&nbsp;the <a href=\"https:\/\/drive.google.com\/a\/ckl.io\/file\/d\/0ByOwmqah_nuGNHEtcU5OekdDMkk\/view\">Single Responsibility Principle<\/a> to create a cleaner and more modular structure for your iOS project. The ideia behind this pattern is to isolate your app&#8217;s dependencies, balancing&nbsp;the delegation of responsibilities among the entities.&nbsp;This is achieved by using the the following architecture:<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" class=\"wp-image-2680 aligncenter\" src=\"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2016\/04\/Viper-Module.png\" alt=\"Viper Module\" width=\"756\" height=\"359\" srcset=\"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2016\/04\/Viper-Module.png 2432w, https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2016\/04\/Viper-Module-768x365.png 768w\" sizes=\"(max-width: 756px) 100vw, 756px\" \/><\/p>\n<p>The diagram above illustrates the VIPER architecture, in which each block corresponds to an object with specific tasks, inputs and outputs. Think of&nbsp;these blocks as workers in an assembly line: once the worker completes its job on an object, the object is passed along to the next worker, until the product is finished.<\/p>\n<p>The connections between the blocks represent the relationship between the objects, and what kind of information they transmit to each other. The communication&nbsp;from one entity to another is&nbsp;given through protocols, which we&#8217;ll explain further in this post.<\/p>\n<h2>2. iOS Project Architecture<\/h2>\n<p>Having in mind the true purpose of the VIPER architecture, it&#8217;s now important to&nbsp;understand&nbsp;a bit more about each part, and what their responsibilities are. To do so, we&#8217;ll develop&nbsp;a basic application (code also available on <a href=\"https:\/\/github.com\/pedrohperalta\/Articles-iOS-VIPER\">GitHub<\/a>) that fetches a list of articles from a REST API and displays them in the user&#8217;s screen.<\/p>\n<h3><\/h3>\n<h3>2.1. View<\/h3>\n<p>&nbsp;<\/p>\n<p>The VIPER View in an iOS application is a UIViewController that contains a&nbsp;sub view, which can be either implemented programmatically or using the interfacer builder (IB). Its sole responsibility is to display what the <strong>Presenter<\/strong>&nbsp;tells it to, and handle the user interactions with the screen. When the user triggers any event that requires processing, the <strong>View<\/strong>&nbsp;simply delegates it to the <strong>Presenter<\/strong>&nbsp;and awaits for a response telling it what should be displayed next.<\/p>\n<p>This is how the&nbsp;<strong>View<\/strong>&nbsp;for our Article Visualization app&nbsp;would look like in Swift:<\/p>\n<pre><code class=\"language-swift\">\n\/*\n * Protocol that defines the view input methods.\n *\/\nprotocol ArticlesViewInterface: class {\n    func showArticlesData(articles: [Article])\n    func showNoContentScreen()\n}\n\n\/*\n * A view responsible for displaying a list\n * of articles fetched from some source.\n *\/\nclass ArticlesViewController : UIViewController, ArticlesViewInterface\n{\n    \/\/ Reference to the Presenter's interface.\n    var presenter: ArticlesModuleInterface!\n\n    \/*\n     * Once the view is loaded, it sends a command\n     * to the presenter asking it to update the UI.\n     *\/\n    override func viewDidLoad() {\n        super.viewDidLoad()\n        self.presenter.updateView()\n    }\n\n    \/\/ MARK: ArticlesViewInterface\n\n    func showArticlesData(articles: [Article]) {\n        self.articles = articles\n        self.tableView.reloadData()\n    }\n\n    func showNoContentScreen() {\n        \/\/ Show custom empty screen.\n    }\n}\n<\/code>\n<\/pre>\n<h3>2.2. Presenter<\/h3>\n<p>&nbsp;<\/p>\n<p>The <strong>Presenter<\/strong> works like a bridge between the main parts of a VIPER module. On&nbsp;one way, it receives input events coming from the View and reacts to them by requesting data to the Interactor. On&nbsp;the other way, it receives the data structures coming from the <strong>Interactor<\/strong>, applies <span style=\"text-decoration: underline;\">view<\/span> logic over this data to prepare the content, and finally tells the <strong>View<\/strong> what to display.<\/p>\n<p>Here&#8217;s an example of a <strong>Presenter<\/strong> for our Article Visualization app:<\/p>\n<pre><code class=\"language-swift\">\n\/*\n * Protocol that defines the commands sent from the View to the Presenter.\n *\/\nprotocol ArticlesModuleInterface: class {\n    func updateView()\n    func showDetailsForArticle(article: Article)\n}\n\n\n\/*\n * Protocol that defines the commands sent from the Interactor to the Presenter.\n *\/\nprotocol ArticlesInteractorOutput: class {\n    func articlesFetched(articles: [Article])\n}\n\n\n\/*\n * The Presenter is also responsible for connecting\n * the other objects inside a VIPER module.\n *\/\nclass ArticlesPresenter : ArticlesModuleInterface, ArticlesInteractorOutput\n{\n    \/\/ Reference to the View (weak to avoid retain cycle).\n    weak var view: ArticlesViewInterface!\n\n    \/\/ Reference to the Interactor's interface.\n    var interactor: ArticlesInteractorInput!\n\n    \/\/ Reference to the Router\n    var wireframe: ArticlesWireframe!\n\n\n    \/\/ MARK: ArticlesModuleInterface\n\n    func updateView() {\n        self.interactor.fetchArticles()\n    }\n\n    func showDetailsForArticle(article: Article) {\n        self.wireframe.presentDetailsInterfaceForArticle(article)\n    }\n\n    \/\/ MARK: ArticlesInteractorOutput\n\n    func articlesFetched(articles: [Article]) {\n        if articles.count &gt; 0 {\n            self.articles = articles\n            self.view.showArticlesData(articles)\n        } else {\n            self.view.showNoContentScreen()\n        }\n    }\n}\n<\/code>\n<\/pre>\n<h3>2.3. Interactor<\/h3>\n<p>&nbsp;<\/p>\n<p>We can think about this object as a collection of use cases inside of a specific module. The <strong>Interactor<\/strong> contains all the business logic related to the entities and should be completely independent of the user interface (UI).<\/p>\n<p>In our Article Visualization&nbsp;app, one use case example is to fetch the list of articles from the server. It&#8217;s the <strong>Interactor<\/strong>&#8216;s responsibility to make the requests, handle the responses and convert them to an <strong>Entity<\/strong> which, in this case, is an Article object.<\/p>\n<p>Once the <strong>Interactor<\/strong> finishes running&nbsp;some task, it notifies the <strong>Presenter<\/strong> about the result obtained. One important thing to have in mind is that the data sent to&nbsp;the&nbsp;<strong>Presenter<\/strong> should not implement&nbsp;any business logic, so the data provided by the <strong>Interactor<\/strong> should be clean and ready to use.<\/p>\n<p>In our Article Visualization app, the <strong>Interactor&nbsp;<\/strong>would be responsible for fetching the articles from an API:<\/p>\n<pre><code class=\"language-swift\">\n\/*\n * Protocol that defines the Interactor's use case.\n *\/\nprotocol ArticlesInteractorInput: class {\n    func fetchArticles()\n}\n\n\n\/*\n * The Interactor responsible for implementing\n * the business logic of the module.\n *\/\nclass ArticlesInteractor : ArticlesInteractorInput\n{\n    \/\/ Url to the desired API.\n    let url = \"https:\/\/www.myendpoint.com\"\n\n    \/\/ Reference to the Presenter's output interface.\n    weak var output: ArticlesInteractorOutput!\n\n\n    \/\/ MARK: ArticlesInteractorInput\n\n    func fetchArticles() {\n        Alamofire.request(.GET, url).responseArray { (response: Response) in\n            let articlesArray = response.result.value\n            self.output.articlesFetched(articlesArray!)\n        }\n    }\n}\n<\/code>\n<\/pre>\n<h3><\/h3>\n<h3>2.4. Entity<\/h3>\n<p>&nbsp;<\/p>\n<p>The <strong>Entity<\/strong>&nbsp;is probably the simplest element&nbsp;inside a VIPER structure. It encapsulates different types of data,&nbsp;and usually is treated as a payload among the other VIPER components. One important thing to notice is that the <strong>Entity<\/strong> is different from the Data Access Layer, which&nbsp;should be handled by the <strong>Interactor<\/strong>.<\/p>\n<p>In our Article Visualization app, the Article class would be an example of an <strong>Entity<\/strong>:<\/p>\n<pre><code class=\"language-swift\">\nclass Article\n{\n    var date: String?\n    var title: String?\n    var website: String?\n    var authors: String?\n    var content: String?\n    var imageUrl: String?\n}\n<\/code>\n<\/pre>\n<h3><\/h3>\n<h3>2.5. Router<\/h3>\n<p>&nbsp;<\/p>\n<p>The last and perhaps most peculiar element in the VIPER&nbsp;architecture is the <strong>Router<\/strong>, which is responsible for the navigation logic between modules, and how they should happen (e.g. defining an animation&nbsp;for presenting a screen, or how the transition between two screens should be done). It receives input commands from the <strong>Presenters<\/strong>&nbsp;to&nbsp;say&nbsp;what screen it should route to. Also, the <strong>Router<\/strong> should be responsible for passing data from one screen to the other.<\/p>\n<p>The <strong>Router<\/strong>&nbsp;should implement a protocol that defines all the navigation possibilities for a specific module. That&#8217;s a good because it enables a quick overview of all the paths an app can take by&nbsp;only looking at&nbsp;a <strong>Router<\/strong>&#8216;s protocol.<\/p>\n<p>Because of a limitation from the iOS framework, only ViewControllers can perform a transition between screens, so a <strong>Router<\/strong> must contain a reference to the module&#8217;s controller, or any of its children.<\/p>\n<p>Here&#8217;s how our router would look like in our Article Visualization app (note that the <strong>Router<\/strong> is widely referred to as <strong>Wireframe<\/strong>).<\/p>\n<pre><code class=\"language-swift\">\n\/*\n * Protocol that defines the possible routes from the Articles module.\n *\/\nprotocol ArticlesWireframeInput {\n    func presentDetailsInterfaceForArticle(article: Article)\n}\n\n\n\/*\n * The Router responsible for navigation between modules.\n *\/\nclass ArticlesWireframe : NSObject, ArticlesWireframeInput\n{\n    \/\/ Reference to the ViewController (weak to avoid retain cycle).\n    weak var articlesViewController: ArticlesViewController!\n\n    \/\/ Reference to the Router of the next VIPER module.\n    var detailsWireframe: DetailsWireframe!\n\n\n    \/\/ MARK: ArticlesWireframeInput\n\n    func presentDetailsInterfaceForArticle(article: Article) {\n        \/\/ Create the Router for the upcoming module.\n        self.detailsWireframe = DetailsWireframe()\n\n        \/\/ Sends the article data to the next module's Presenter.\n        self.sendArticleToDetailsPresenter(self.detailsWireframe.detailsPresenter, article: article)\n\n        \/\/ Presents the next View.\n        self.detailsWireframe.presentArticleDetailsInterfaceFromViewController(self.articlesViewController)\n    }\n\n\n    \/\/ MARK: Private\n\n    private func sendArticleToDetailsPresenter(detailsPresenter: DetailsPresenter, article: Article) {\n        detailsPresenter.article = article\n    }\n}\n<\/code>\n<\/pre>\n<h2>3.&nbsp;When should you use VIPER?<\/h2>\n<p>When creating a project&nbsp;that has a potential of evolving, it&#8217;s important to think of a structure that will scale well and enable&nbsp;many developers to simultaneously work&nbsp;on it as seamlessly as possible \u2013 and the&nbsp;MVC structure might not be enough to keep your project sufficiently organized.<\/p>\n<p>It&#8217;s really common for developers to find themselves&nbsp;debugging&nbsp;a huge class, like trying to find a needle in a haystack. With the loose coupling between the objects that&nbsp;VIPER proposes, you&#8217;ll notice that:<\/p>\n<ul>\n<li>It&#8217;s easier to&nbsp;track issues via crash reports (due to the Single Responsibility Principle)<\/li>\n<li>Adding&nbsp;new features is easier<\/li>\n<li>The source code will be cleaner, more compact and reusable<\/li>\n<li>There are less conflicts with the rest of the development team<\/li>\n<li>It&#8217;s easier to write automated tests (!), since your UI logic is separated from the business logic.<\/li>\n<\/ul>\n<h2>4.&nbsp;When should you NOT use VIPER?<\/h2>\n<p>As for every problem&nbsp;you&#8217;re trying to solve, you should recur to the tool that best suits your needs. Due to the number of elements involved, this architecture&nbsp;causes an overhead when starting a new project (though it largely pays off&nbsp;in the long run), so VIPER can&nbsp;be an overkill for small projects that do not intend to scale.<\/p>\n<p>If the team isn&#8217;t completely aligned with maintaining the VIPER&nbsp;structure, you&#8217;ll end up with an MVC-VIPER mix that can cause headaches \u2013 so make sure the team is completely in&nbsp;sync before moving forward with VIPER.<\/p>\n<h2>5. Wrapping up<\/h2>\n<p>VIPER is a really cool iOS project architecture pattern&nbsp;among others, like MVP&nbsp;and&nbsp;MVVM. If you&#8217;re curious to know more about the VIPER architecture,&nbsp;you can check out the <a href=\"https:\/\/github.com\/pedrohperalta\/Articles-iOS-VIPER\" target=\"_blank\" rel=\"noopener\">repository<\/a> with the full implementation of the&nbsp;example used in this post. Feel&nbsp;free to contribute with issues and pull requests!<\/p>\n<p>What is your favorite iOS project architecture? Please share your opinion in the comments!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When developing an iOS app, it&#8217;s important to think about what&nbsp;iOS project architecture you should use. Most developers use the pattern&nbsp;suggested by Apple: the so-called MVC (Model-View-Controller) architecture. However, as well-established as it is, the MVC has its flaws. &nbsp;For one, because of its simplicity, it leads even the most experienced engineers&nbsp;to put&nbsp;any code that [&hellip;]<\/p>\n","protected":false},"author":65,"featured_media":2938,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[432,7],"tags":[287,123],"class_list":["post-2644","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-engineering","category-opinion","tag-tag-code","tag-tag-ios-development"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>iOS Project Architecture: Using VIPER<\/title>\n<meta name=\"description\" content=\"Learn how to develop a simple iOS project in Swift using VIPER, one of the trending iOS Project Architecture alternatives to MVC.\" \/>\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-project-architecture-using-viper\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"iOS Project Architecture: Using VIPER\" \/>\n<meta property=\"og:description\" content=\"Learn how to develop a simple iOS project in Swift using VIPER, one of the trending iOS Project Architecture alternatives to MVC.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cheesecakelabs.com\/blog\/ios-project-architecture-using-viper\/\" \/>\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=\"2016-04-28T19:11:58+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-07-01T17:59:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2016\/04\/viper_architecture.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"2076\" \/>\n\t<meta property=\"og:image:height\" content=\"720\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\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=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/ios-project-architecture-using-viper\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/ios-project-architecture-using-viper\/\"},\"author\":{\"name\":\"Pedro Henrique Peralta\"},\"headline\":\"iOS Project Architecture: Using VIPER\",\"datePublished\":\"2016-04-28T19:11:58+00:00\",\"dateModified\":\"2022-07-01T17:59:13+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/ios-project-architecture-using-viper\/\"},\"wordCount\":1310,\"commentCount\":4,\"image\":{\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/ios-project-architecture-using-viper\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2016\/04\/viper_architecture.jpg\",\"keywords\":[\"code\",\"iOS development\"],\"articleSection\":[\"Engineering\",\"Opinion\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/cheesecakelabs.com\/blog\/ios-project-architecture-using-viper\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/ios-project-architecture-using-viper\/\",\"url\":\"https:\/\/cheesecakelabs.com\/blog\/ios-project-architecture-using-viper\/\",\"name\":\"iOS Project Architecture: Using VIPER\",\"isPartOf\":{\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/ios-project-architecture-using-viper\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/ios-project-architecture-using-viper\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2016\/04\/viper_architecture.jpg\",\"datePublished\":\"2016-04-28T19:11:58+00:00\",\"dateModified\":\"2022-07-01T17:59:13+00:00\",\"author\":{\"@type\":\"person\",\"name\":\"Pedro Henrique Peralta\"},\"description\":\"Learn how to develop a simple iOS project in Swift using VIPER, one of the trending iOS Project Architecture alternatives to MVC.\",\"breadcrumb\":{\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/ios-project-architecture-using-viper\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/cheesecakelabs.com\/blog\/ios-project-architecture-using-viper\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/ios-project-architecture-using-viper\/#primaryimage\",\"url\":\"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2016\/04\/viper_architecture.jpg\",\"contentUrl\":\"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2016\/04\/viper_architecture.jpg\",\"width\":2076,\"height\":720},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/cheesecakelabs.com\/blog\/ios-project-architecture-using-viper\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/cheesecakelabs.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"iOS Project Architecture: Using 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\":\"Pedro Henrique Peralta\",\"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\/2017\/09\/pedro-300x300.jpg\",\"contentUrl\":\"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2017\/09\/pedro-300x300.jpg\",\"caption\":\"Pedro Henrique Peralta\"},\"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\/pedro-2\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"iOS Project Architecture: Using VIPER","description":"Learn how to develop a simple iOS project in Swift using VIPER, one of the trending iOS Project Architecture alternatives to MVC.","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-project-architecture-using-viper\/","og_locale":"en_US","og_type":"article","og_title":"iOS Project Architecture: Using VIPER","og_description":"Learn how to develop a simple iOS project in Swift using VIPER, one of the trending iOS Project Architecture alternatives to MVC.","og_url":"https:\/\/cheesecakelabs.com\/blog\/ios-project-architecture-using-viper\/","og_site_name":"Cheesecake Labs","article_publisher":"https:\/\/www.facebook.com\/cheesecakelabs","article_published_time":"2016-04-28T19:11:58+00:00","article_modified_time":"2022-07-01T17:59:13+00:00","og_image":[{"width":2076,"height":720,"url":"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2016\/04\/viper_architecture.jpg","type":"image\/jpeg"}],"author":"Cheesecake Labs","twitter_card":"summary_large_image","twitter_creator":"@cheesecakelabs","twitter_site":"@cheesecakelabs","twitter_misc":{"Written by":null,"Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/cheesecakelabs.com\/blog\/ios-project-architecture-using-viper\/#article","isPartOf":{"@id":"https:\/\/cheesecakelabs.com\/blog\/ios-project-architecture-using-viper\/"},"author":{"name":"Pedro Henrique Peralta"},"headline":"iOS Project Architecture: Using VIPER","datePublished":"2016-04-28T19:11:58+00:00","dateModified":"2022-07-01T17:59:13+00:00","mainEntityOfPage":{"@id":"https:\/\/cheesecakelabs.com\/blog\/ios-project-architecture-using-viper\/"},"wordCount":1310,"commentCount":4,"image":{"@id":"https:\/\/cheesecakelabs.com\/blog\/ios-project-architecture-using-viper\/#primaryimage"},"thumbnailUrl":"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2016\/04\/viper_architecture.jpg","keywords":["code","iOS development"],"articleSection":["Engineering","Opinion"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/cheesecakelabs.com\/blog\/ios-project-architecture-using-viper\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/cheesecakelabs.com\/blog\/ios-project-architecture-using-viper\/","url":"https:\/\/cheesecakelabs.com\/blog\/ios-project-architecture-using-viper\/","name":"iOS Project Architecture: Using VIPER","isPartOf":{"@id":"https:\/\/cheesecakelabs.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/cheesecakelabs.com\/blog\/ios-project-architecture-using-viper\/#primaryimage"},"image":{"@id":"https:\/\/cheesecakelabs.com\/blog\/ios-project-architecture-using-viper\/#primaryimage"},"thumbnailUrl":"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2016\/04\/viper_architecture.jpg","datePublished":"2016-04-28T19:11:58+00:00","dateModified":"2022-07-01T17:59:13+00:00","author":{"@type":"person","name":"Pedro Henrique Peralta"},"description":"Learn how to develop a simple iOS project in Swift using VIPER, one of the trending iOS Project Architecture alternatives to MVC.","breadcrumb":{"@id":"https:\/\/cheesecakelabs.com\/blog\/ios-project-architecture-using-viper\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cheesecakelabs.com\/blog\/ios-project-architecture-using-viper\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cheesecakelabs.com\/blog\/ios-project-architecture-using-viper\/#primaryimage","url":"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2016\/04\/viper_architecture.jpg","contentUrl":"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2016\/04\/viper_architecture.jpg","width":2076,"height":720},{"@type":"BreadcrumbList","@id":"https:\/\/cheesecakelabs.com\/blog\/ios-project-architecture-using-viper\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cheesecakelabs.com\/blog\/"},{"@type":"ListItem","position":2,"name":"iOS Project Architecture: Using 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":"Pedro Henrique Peralta","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\/2017\/09\/pedro-300x300.jpg","contentUrl":"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2017\/09\/pedro-300x300.jpg","caption":"Pedro Henrique Peralta"},"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\/pedro-2\/"}]}},"_links":{"self":[{"href":"https:\/\/cheesecakelabs.com\/blog\/wp-json\/wp\/v2\/posts\/2644","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=2644"}],"version-history":[{"count":1,"href":"https:\/\/cheesecakelabs.com\/blog\/wp-json\/wp\/v2\/posts\/2644\/revisions"}],"predecessor-version":[{"id":10351,"href":"https:\/\/cheesecakelabs.com\/blog\/wp-json\/wp\/v2\/posts\/2644\/revisions\/10351"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cheesecakelabs.com\/blog\/wp-json\/wp\/v2\/media\/2938"}],"wp:attachment":[{"href":"https:\/\/cheesecakelabs.com\/blog\/wp-json\/wp\/v2\/media?parent=2644"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cheesecakelabs.com\/blog\/wp-json\/wp\/v2\/categories?post=2644"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cheesecakelabs.com\/blog\/wp-json\/wp\/v2\/tags?post=2644"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}