{"id":1154,"date":"2014-01-18T15:42:13","date_gmt":"2014-01-18T10:12:13","guid":{"rendered":"https:\/\/www.innovationm.com\/blog\/?p=1154"},"modified":"2014-01-31T15:47:04","modified_gmt":"2014-01-31T10:17:04","slug":"ios-best-architecture-design-and-coding-practices","status":"publish","type":"post","link":"https:\/\/www.innovationm.com\/blog\/ios-best-architecture-design-and-coding-practices\/","title":{"rendered":"iOS &#8211; Best Architecture, Design and Coding Practices"},"content":{"rendered":"<p>We have identified some of the best practices that we need to follow while working on architecture, design and development of iOS applications. We will keep on adding more and more to it. Stay tuned\u2026<\/p>\n<h1><span style=\"color: #3366ff;\">Best Coding Practices<\/span><\/h1>\n<h2>Image files naming convention<\/h2>\n<p>There are four types of devices that we need to support while developing iOS Application. These are:<\/p>\n<ol>\n<li>iPhone (Non-Retina)<\/li>\n<li>iPhone (Retina)<\/li>\n<li>iPad (Non-Retina)<\/li>\n<li>iPad (Retina)<\/li>\n<\/ol>\n<p><strong>Naming convention:<\/strong><\/p>\n<p>Image is username.png. There are 4 images created for supporting 4 types of devices. Here is the naming convention:<\/p>\n<p><span style=\"font-size: 1rem; line-height: 1.714285714;\">iPhone:<\/span><br \/>\nusername~iphone.png (Non-Retina)<br \/>\nusername@2x~iphone.png (Retina)<\/p>\n<p>iPad:<br \/>\nusername~ipad.png (Non-Retina)<br \/>\nusername@2x~ipad.png (Retina)<\/p>\n<p>How to refer them in the code and storyboard<\/p>\n<p><strong>Referring this image in the code:<\/strong><br \/>\n[UIImage imageNamed:@&#8221;username&#8221;];<\/p>\n<p><strong>Referring this image in the storyboard<\/strong>:<\/p>\n<p>iPhone storyboard:<br \/>\n&lt;imageView userInteractionEnabled=&#8221;NO&#8221; contentMode=&#8221;scaleAspectFit&#8221; horizontalHuggingPriority=&#8221;251&#8243; verticalHuggingPriority=&#8221;251&#8243; image= <span style=\"color: #ff6600;\">&#8220;username.png&#8221;<\/span> translatesAutoresizingMaskIntoConstraints=&#8221;NO&#8221; id=&#8221;4d0-HY-bjJ&#8221;&gt;<br \/>\n&lt;rect key=&#8221;frame&#8221; x=&#8221;11&#8243; y=&#8221;14&#8243; width=&#8221;23&#8243; height=&#8221;23&#8243;\/&gt;<br \/>\n&lt;autoresizingMask key=&#8221;autoresizingMask&#8221; widthSizable=&#8221;YES&#8221; heightSizable=&#8221;YES&#8221;\/&gt;<br \/>\n&lt;constraints&gt;<br \/>\n&lt;constraint firstAttribute=&#8221;height&#8221; constant=&#8221;23&#8243; id=&#8221;M1s-uZ-vgv&#8221;\/&gt;<br \/>\n&lt;constraint firstAttribute=&#8221;width&#8221; constant=&#8221;23&#8243; id=&#8221;lrU-RP-6NN&#8221;\/&gt;<br \/>\n&lt;\/constraints&gt;<br \/>\n&lt;\/imageView&gt;<\/p>\n<p>iPad storyboard:<br \/>\n&lt;imageView userInteractionEnabled=&#8221;NO&#8221; contentMode=&#8221;scaleAspectFit&#8221; horizontalHuggingPriority=&#8221;251&#8243; verticalHuggingPriority=&#8221;251&#8243; image=\u00a0<span style=\"color: #ff6600;\">&#8220;username.png&#8221; <\/span>translatesAutoresizingMaskIntoConstraints=&#8221;NO&#8221; id=&#8221;4d0-HY-bjJ&#8221;&gt;<br \/>\n&lt;rect key=&#8221;frame&#8221; x=&#8221;11&#8243; y=&#8221;13&#8243; width=&#8221;25&#8243; height=&#8221;25&#8243;\/&gt;<br \/>\n&lt;autoresizingMask key=&#8221;autoresizingMask&#8221; widthSizable=&#8221;YES&#8221; heightSizable=&#8221;YES&#8221;\/&gt;<br \/>\n&lt;constraints&gt;<br \/>\n&lt;constraint firstAttribute=&#8221;width&#8221; constant=&#8221;25&#8243; id=&#8221;NeQ-Pc-jIn&#8221;\/&gt;<br \/>\n&lt;constraint firstAttribute=&#8221;height&#8221; constant=&#8221;25&#8243; id=&#8221;v7K-G6-sTx&#8221;\/&gt;<br \/>\n&lt;\/constraints&gt;<br \/>\n&lt;\/imageView&gt;<\/p>\n<p><strong>Benefits:<\/strong><br \/>\n1. When you run the app then OS will pick-up the right image for non-retina \/ retina device and also for iPhone and iPad.<br \/>\n2. Ease of managing the images.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We have identified some of the best practices that we need to follow while working on architecture, design and development of iOS applications. We will keep on adding more and more to it. Stay tuned\u2026 Best Coding Practices Image files naming convention There are four types of devices that we need to support while developing [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":1162,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,71,8],"tags":[123,121,160,122,89,165],"class_list":["post-1154","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ios","category-mobile","category-mobile-architecture-and-design","tag-best-coding-practices","tag-best-practices","tag-ios","tag-ipad","tag-iphone","tag-mobile"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>iOS - Best Architecture, Design and Coding Practices | InnovationM Blog<\/title>\n<meta name=\"description\" content=\"Some of the best practices that we need to follow while working on architecture, design and development of iOS applications.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.innovationm.com\/blog\/ios-best-architecture-design-and-coding-practices\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"iOS - Best Architecture, Design and Coding Practices | InnovationM Blog\" \/>\n<meta property=\"og:description\" content=\"Some of the best practices that we need to follow while working on architecture, design and development of iOS applications.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.innovationm.com\/blog\/ios-best-architecture-design-and-coding-practices\/\" \/>\n<meta property=\"og:site_name\" content=\"InnovationM - Blog\" \/>\n<meta property=\"article:published_time\" content=\"2014-01-18T10:12:13+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2014-01-31T10:17:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/InnovationM-iOS-\u2013-Best-Architecture-Design-Coding-Practices-.png\" \/>\n\t<meta property=\"og:image:width\" content=\"624\" \/>\n\t<meta property=\"og:image:height\" content=\"250\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Manish Seth\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Manish Seth\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/ios-best-architecture-design-and-coding-practices\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/ios-best-architecture-design-and-coding-practices\\\/\"},\"author\":{\"name\":\"Manish Seth\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#\\\/schema\\\/person\\\/03f59a9465a9f03b551985392f877ae8\"},\"headline\":\"iOS &#8211; Best Architecture, Design and Coding Practices\",\"datePublished\":\"2014-01-18T10:12:13+00:00\",\"dateModified\":\"2014-01-31T10:17:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/ios-best-architecture-design-and-coding-practices\\\/\"},\"wordCount\":295,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/ios-best-architecture-design-and-coding-practices\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2014\\\/01\\\/InnovationM-iOS-\u2013-Best-Architecture-Design-Coding-Practices-.png\",\"keywords\":[\"Best Coding Practices\",\"Best Practices\",\"iOS\",\"iPad\",\"iPhone\",\"Mobile\"],\"articleSection\":[\"iOS\",\"Mobile\",\"Mobile Architecture and Design\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/ios-best-architecture-design-and-coding-practices\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/ios-best-architecture-design-and-coding-practices\\\/\",\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/ios-best-architecture-design-and-coding-practices\\\/\",\"name\":\"iOS - Best Architecture, Design and Coding Practices | InnovationM Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/ios-best-architecture-design-and-coding-practices\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/ios-best-architecture-design-and-coding-practices\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2014\\\/01\\\/InnovationM-iOS-\u2013-Best-Architecture-Design-Coding-Practices-.png\",\"datePublished\":\"2014-01-18T10:12:13+00:00\",\"dateModified\":\"2014-01-31T10:17:04+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#\\\/schema\\\/person\\\/03f59a9465a9f03b551985392f877ae8\"},\"description\":\"Some of the best practices that we need to follow while working on architecture, design and development of iOS applications.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/ios-best-architecture-design-and-coding-practices\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/ios-best-architecture-design-and-coding-practices\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/ios-best-architecture-design-and-coding-practices\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2014\\\/01\\\/InnovationM-iOS-\u2013-Best-Architecture-Design-Coding-Practices-.png\",\"contentUrl\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2014\\\/01\\\/InnovationM-iOS-\u2013-Best-Architecture-Design-Coding-Practices-.png\",\"width\":624,\"height\":250,\"caption\":\"iOS \u2013 Best Architecture, Design and Coding Practices\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/ios-best-architecture-design-and-coding-practices\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"iOS &#8211; Best Architecture, Design and Coding Practices\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/\",\"name\":\"InnovationM - Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#\\\/schema\\\/person\\\/03f59a9465a9f03b551985392f877ae8\",\"name\":\"Manish Seth\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a5ed7a8bee434c0f1b851face1f5c946c36929374fd4627a3fc3958d67517eff?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a5ed7a8bee434c0f1b851face1f5c946c36929374fd4627a3fc3958d67517eff?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a5ed7a8bee434c0f1b851face1f5c946c36929374fd4627a3fc3958d67517eff?s=96&r=g\",\"caption\":\"Manish Seth\"},\"sameAs\":[\"http:\\\/\\\/www.innovationm.com\\\/\"],\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/author\\\/manish-seth\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"iOS - Best Architecture, Design and Coding Practices | InnovationM Blog","description":"Some of the best practices that we need to follow while working on architecture, design and development of iOS applications.","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:\/\/www.innovationm.com\/blog\/ios-best-architecture-design-and-coding-practices\/","og_locale":"en_US","og_type":"article","og_title":"iOS - Best Architecture, Design and Coding Practices | InnovationM Blog","og_description":"Some of the best practices that we need to follow while working on architecture, design and development of iOS applications.","og_url":"https:\/\/www.innovationm.com\/blog\/ios-best-architecture-design-and-coding-practices\/","og_site_name":"InnovationM - Blog","article_published_time":"2014-01-18T10:12:13+00:00","article_modified_time":"2014-01-31T10:17:04+00:00","og_image":[{"width":624,"height":250,"url":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/InnovationM-iOS-\u2013-Best-Architecture-Design-Coding-Practices-.png","type":"image\/png"}],"author":"Manish Seth","twitter_misc":{"Written by":"Manish Seth","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.innovationm.com\/blog\/ios-best-architecture-design-and-coding-practices\/#article","isPartOf":{"@id":"https:\/\/www.innovationm.com\/blog\/ios-best-architecture-design-and-coding-practices\/"},"author":{"name":"Manish Seth","@id":"https:\/\/www.innovationm.com\/blog\/#\/schema\/person\/03f59a9465a9f03b551985392f877ae8"},"headline":"iOS &#8211; Best Architecture, Design and Coding Practices","datePublished":"2014-01-18T10:12:13+00:00","dateModified":"2014-01-31T10:17:04+00:00","mainEntityOfPage":{"@id":"https:\/\/www.innovationm.com\/blog\/ios-best-architecture-design-and-coding-practices\/"},"wordCount":295,"commentCount":0,"image":{"@id":"https:\/\/www.innovationm.com\/blog\/ios-best-architecture-design-and-coding-practices\/#primaryimage"},"thumbnailUrl":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/InnovationM-iOS-\u2013-Best-Architecture-Design-Coding-Practices-.png","keywords":["Best Coding Practices","Best Practices","iOS","iPad","iPhone","Mobile"],"articleSection":["iOS","Mobile","Mobile Architecture and Design"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.innovationm.com\/blog\/ios-best-architecture-design-and-coding-practices\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.innovationm.com\/blog\/ios-best-architecture-design-and-coding-practices\/","url":"https:\/\/www.innovationm.com\/blog\/ios-best-architecture-design-and-coding-practices\/","name":"iOS - Best Architecture, Design and Coding Practices | InnovationM Blog","isPartOf":{"@id":"https:\/\/www.innovationm.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.innovationm.com\/blog\/ios-best-architecture-design-and-coding-practices\/#primaryimage"},"image":{"@id":"https:\/\/www.innovationm.com\/blog\/ios-best-architecture-design-and-coding-practices\/#primaryimage"},"thumbnailUrl":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/InnovationM-iOS-\u2013-Best-Architecture-Design-Coding-Practices-.png","datePublished":"2014-01-18T10:12:13+00:00","dateModified":"2014-01-31T10:17:04+00:00","author":{"@id":"https:\/\/www.innovationm.com\/blog\/#\/schema\/person\/03f59a9465a9f03b551985392f877ae8"},"description":"Some of the best practices that we need to follow while working on architecture, design and development of iOS applications.","breadcrumb":{"@id":"https:\/\/www.innovationm.com\/blog\/ios-best-architecture-design-and-coding-practices\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.innovationm.com\/blog\/ios-best-architecture-design-and-coding-practices\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.innovationm.com\/blog\/ios-best-architecture-design-and-coding-practices\/#primaryimage","url":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/InnovationM-iOS-\u2013-Best-Architecture-Design-Coding-Practices-.png","contentUrl":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/InnovationM-iOS-\u2013-Best-Architecture-Design-Coding-Practices-.png","width":624,"height":250,"caption":"iOS \u2013 Best Architecture, Design and Coding Practices"},{"@type":"BreadcrumbList","@id":"https:\/\/www.innovationm.com\/blog\/ios-best-architecture-design-and-coding-practices\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.innovationm.com\/blog\/"},{"@type":"ListItem","position":2,"name":"iOS &#8211; Best Architecture, Design and Coding Practices"}]},{"@type":"WebSite","@id":"https:\/\/www.innovationm.com\/blog\/#website","url":"https:\/\/www.innovationm.com\/blog\/","name":"InnovationM - Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.innovationm.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.innovationm.com\/blog\/#\/schema\/person\/03f59a9465a9f03b551985392f877ae8","name":"Manish Seth","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/a5ed7a8bee434c0f1b851face1f5c946c36929374fd4627a3fc3958d67517eff?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/a5ed7a8bee434c0f1b851face1f5c946c36929374fd4627a3fc3958d67517eff?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a5ed7a8bee434c0f1b851face1f5c946c36929374fd4627a3fc3958d67517eff?s=96&r=g","caption":"Manish Seth"},"sameAs":["http:\/\/www.innovationm.com\/"],"url":"https:\/\/www.innovationm.com\/blog\/author\/manish-seth\/"}]}},"_links":{"self":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/posts\/1154","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/comments?post=1154"}],"version-history":[{"count":0,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/posts\/1154\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/media\/1162"}],"wp:attachment":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/media?parent=1154"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/categories?post=1154"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/tags?post=1154"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}