{"id":49708,"date":"2017-08-01T09:31:28","date_gmt":"2017-08-01T04:01:28","guid":{"rendered":"https:\/\/2thenew.online\/blog\/?p=49708"},"modified":"2022-01-13T14:11:15","modified_gmt":"2022-01-13T08:41:15","slug":"recursive-enumerations-in-swift","status":"publish","type":"post","link":"https:\/\/2thenew.online\/blog\/recursive-enumerations-in-swift\/","title":{"rendered":"Recursive Enumerations in Swift"},"content":{"rendered":"<p class=\"p1\"><strong>Why use Recursion?<\/strong><\/p>\n<ul>\n<li class=\"p3\">When we say recursion, we are referring to a technique where an object is referring to itself.<\/li>\n<li class=\"p3\">They&#8217;re useful<b> where you need to do the representation of hierarchical structure like trees, network\/graphs<\/b>, which otherwise would be complicated to be represented using loops.<\/li>\n<li class=\"p3\"><b>It is possible to achieve recursion technique with reference types(class) since reference stores their instances.<\/b><\/li>\n<li class=\"p3\">Because value types are copied unlike reference types, we cannot use them to achieve recursion.<\/li>\n<li class=\"p3\">Since Swift made value types like <span class=\"s1\"><code>struct,\u00a0<\/code><\/span><code>enum <\/code>a first class citizen, it introduces a possibility of handling recursion with value type using a recursive enum.<\/li>\n<\/ul>\n<p class=\"p1\"><strong>What is Recursive Enum?<\/strong><\/p>\n<ul>\n<li class=\"p1\">Recursive Enums works on the above-mentioned principle of recursion.<\/li>\n<li>Let&#8217;s consider <strong>an example of representing Family Tree using the recursive enum<\/strong>. The scenario is shown in the figure below:<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-49815 size-full alignnone aligncenter\" src=\"\/blog\/wp-ttn-blog\/uploads\/2017\/06\/Screen-Shot-2017-06-28-at-10.45.00-AM.png\" alt=\"Blog image\" width=\"1195\" height=\"602\" srcset=\"https:\/\/2thenew.online\/blog\/wp-content\/uploads\/2017\/06\/Screen-Shot-2017-06-28-at-10.45.00-AM.png 1195w, https:\/\/2thenew.online\/blog\/wp-content\/uploads\/2017\/06\/Screen-Shot-2017-06-28-at-10.45.00-AM-300x151.png 300w, https:\/\/2thenew.online\/blog\/wp-content\/uploads\/2017\/06\/Screen-Shot-2017-06-28-at-10.45.00-AM-1024x515.png 1024w, https:\/\/2thenew.online\/blog\/wp-content\/uploads\/2017\/06\/Screen-Shot-2017-06-28-at-10.45.00-AM-624x314.png 624w\" sizes=\"auto, (max-width: 1195px) 100vw, 1195px\" \/><\/p>\n<ul>\n<li><strong>In recursive enumeration, one or more cases have the type of an associated value to be the enumeration itself.<\/strong><\/li>\n<\/ul>\n<p>[code language=&#8221;objc&#8221;]<br \/>\nindirect enum FamilyTree {<br \/>\n\tcase noKnownParents<br \/>\n\tcase oneKnownParent(name: String, ancestors: FamilyTreeOne)<br \/>\n\tcase twoKnownParents(fatherName: String, fatherAncestors: FamilyTreeOne,<br \/>\n\tmotherName: String, motherAncestors: FamilyTreeOne)<br \/>\n}<br \/>\n[\/code]<\/p>\n<p>Or another syntax<\/p>\n<p>[code language=&#8221;objc&#8221;]<br \/>\nenum FamilyTree {<br \/>\n\tcase noKnownParents<br \/>\n\tindirect case oneKnownParent(name: String, ancestors: FamilyTreeTwo)<br \/>\n\tindirect case twoKnownParents(fatherName: String, fatherAncestors: FamilyTreeTwo,<br \/>\n\tmotherName: String, motherAncestors: FamilyTreeTwo)<br \/>\n}<br \/>\n[\/code]<\/p>\n<p><span style=\"text-decoration: underline\"><strong>The indirect keyword<\/strong><\/span><\/p>\n<ul>\n<li>Recursive enums require the keyword\u00a0<code>indirect<\/code> either before enum keyword or before the specific case.<\/li>\n<\/ul>\n<p>So what&#8217;s the deal with this keyword\u00a0indirect? Let&#8217;s understand how it works:<\/p>\n<ul>\n<li>For every instance created for a type in Swift, <strong>the compiler requires the knowledge of how much memory will it occupy.<\/strong><\/li>\n<li>For a Swift enum<strong>, an\u00a0instance of an enum will only have one case assigned to itself\u00a0<\/strong>(which may change as your code runs) at any given point of time.<\/li>\n<li>The <strong>compiler now checks which case of the enum will occupy the maximum memory.<\/strong><\/li>\n<li>Hence, the\u00a0instance of enum created will have the<strong> required memory plus any additional requirement by the compiler for tracking which case is currently assigned.<\/strong><\/li>\n<\/ul>\n<p>Consider the below\u00a0example<span style=\"background-color: #f5f6f5\">\u00a0<\/span>:<\/p>\n<p>[code language=&#8221;objc&#8221;]<br \/>\nenum Area {<br \/>\n\tcase square(side:Double)<br \/>\n\tcase rectangle(length: Double, breadth: Double)<br \/>\n}<br \/>\n[\/code]<\/p>\n<ul>\n<li>Since the case\u00a0<code>square<\/code> has one associated value, the amount of the memory required to create an instance will be one Double\u2019s worth of memory with any additional memory for tracking by the compiler.<\/li>\n<li>Similarly, the\u00a0instance of the case\u00a0<code>rectangle<\/code> will have the total memory \u00a016 bytes + any additional memory for tracking.<\/li>\n<li>Now in <code>FamilyTree<\/code>\u00a0 enum, the memory required for creating an instance of the case\u00a0<code>oneKnownParent<\/code> will be the\u00a0memory to hold a \u00a0String and an instance of\u00a0<code>FamilyTree.<\/code><\/li>\n<li><strong>The compiler cannot determine how big a<\/strong> <code>FamilyTree<\/code>\u00a0<strong>is <\/strong>or we could say that\u00a0<code>FamilyTree<\/code><strong>\u00a0would require an infinite amount of memory.<\/strong><\/li>\n<li>For this reason, <strong>we use the keyword<\/strong> <code>indirect <\/code><strong>which instructs the compiler to store the enum\u2019s data behind a pointer.<\/strong><\/li>\n<li><strong>The compiler now puts the data somewhere else in memory and creates a pointer to the associated data rather than making the instance of<\/strong> <code>FamilyTree<\/code> <strong>big enough to hold the data.<\/strong><\/li>\n<\/ul>\n<p style=\"padding-left: 30px\"><strong><span style=\"text-decoration: underline\">Example:<\/span><\/strong> Now let&#8217;s implement our above Family Tree by creating an instance of enum\u00a0<code>FamilyTree<\/code><\/p>\n<p>[code language=&#8221;objc&#8221;]<br \/>\nlet fredAncestors = FamilyTree.twoKnownParents(<br \/>\n    fatherName: &quot;Fred Sr.&quot;,<br \/>\n    fatherAncestors: .oneKnownParent(name: &quot;Beth&quot;, ancestors: .noKnownParents),<br \/>\n    motherName: &quot;Marsha&quot;,<br \/>\n    motherAncestors: .noKnownParents)<br \/>\n[\/code]<\/p>\n<p style=\"padding-left: 30px\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-49816 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2017\/06\/Screen-Shot-2017-06-28-at-10.49.49-AM.png\" alt=\"Screen Shot 2017-06-28 at 10.49.49 AM\" width=\"1035\" height=\"549\" srcset=\"https:\/\/2thenew.online\/blog\/wp-content\/uploads\/2017\/06\/Screen-Shot-2017-06-28-at-10.49.49-AM.png 1035w, https:\/\/2thenew.online\/blog\/wp-content\/uploads\/2017\/06\/Screen-Shot-2017-06-28-at-10.49.49-AM-300x159.png 300w, https:\/\/2thenew.online\/blog\/wp-content\/uploads\/2017\/06\/Screen-Shot-2017-06-28-at-10.49.49-AM-1024x543.png 1024w, https:\/\/2thenew.online\/blog\/wp-content\/uploads\/2017\/06\/Screen-Shot-2017-06-28-at-10.49.49-AM-624x330.png 624w\" sizes=\"auto, (max-width: 1035px) 100vw, 1035px\" \/><\/p>\n<ul>\n<li class=\"p1\">If you check the\u00a0<b>size of the instance <code>fredAncestors,<\/code><\/b><span class=\"Apple-converted-space\">\u00a0<strong>it&#8217;<\/strong><\/span><b>s\u00a08 bytes on a 64-bit architecture \u2013 the size of one pointer.<\/b><\/li>\n<\/ul>\n<p>[code language=&#8221;objc&#8221;]<br \/>\nMemoryLayout.size(ofValue:fredAncestors)<br \/>\n[\/code]<\/p>\n<p style=\"padding-left: 30px\"><strong><span style=\"text-decoration: underline\">Example<\/span>:\u00a0<\/strong>Another common example of recursive enum is doing the arithmetic operation as shown below:<\/p>\n<p>[code language=&#8221;objc&#8221;]<br \/>\nindirect enum ArithmeticExpressions {<br \/>\n\tcase number(Int)<br \/>\n\tcase addition(ArithmeticExpressions, ArithmeticExpressions)<br \/>\n\tcase multiplication(ArithmeticExpressions, ArithmeticExpressions)<br \/>\n}<br \/>\nfunc evaluate(_ expression: ArithmeticExpressions) -&gt; Int<br \/>\n\tswitch expression {<br \/>\n\t\tcase let .number(value):<br \/>\n\t\t\treturn value<br \/>\n\t\tcase let .addition(left, right):<br \/>\n\t\t\treturn evaluate(left) + evaluate(right)<br \/>\n\t\tcase let .multiplication(left, right):<br \/>\n\t\t\treturn evaluate(left) * evaluate(right)<br \/>\n\t}<br \/>\n}<br \/>\nlet multiplicationEnumType = ArithmeticExpressions.multiplication(.number(4), .number(4))<br \/>\nevaluate(multiplicationEnumType)<br \/>\n[\/code]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Why use Recursion? When we say recursion, we are referring to a technique where an object is referring to itself. They&#8217;re useful where you need to do the representation of hierarchical structure like trees, network\/graphs, which otherwise would be complicated to be represented using loops. It is possible to achieve recursion technique with reference types(class) [&hellip;]<\/p>\n","protected":false},"author":1072,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"image","meta":{"iawp_total_views":111,"footnotes":""},"categories":[1400,1994,1],"tags":[4848,4690,4621,4689,2715,3722,4534],"class_list":["post-49708","post","type-post","status-publish","format-image","hentry","category-ios","category-software-development","category-technology","tag-ios","tag-keyword","tag-recursion","tag-recursive-enum","tag-swift","tag-swift-3","tag-swift-enum","post_format-post-format-image"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"The blog describes what is recursive and what is its importance with the help of few examples.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Piyush George\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/2thenew.online\/blog\/recursive-enumerations-in-swift\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"TO THE NEW BLOG\" \/>\n\t\t<meta property=\"og:type\" content=\"blog\" \/>\n\t\t<meta property=\"og:title\" content=\"Recursive Enumerations in Swift | TO THE NEW Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"The blog describes what is recursive and what is its importance with the help of few examples.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/2thenew.online\/blog\/recursive-enumerations-in-swift\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/2thenew.online\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/2thenew.online\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@tothenew\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Recursive Enumerations in Swift | TO THE NEW Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"The blog describes what is recursive and what is its importance with the help of few examples.\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/2thenew.online\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/recursive-enumerations-in-swift\\\/#article\",\"name\":\"Recursive Enumerations in Swift | TO THE NEW Blog\",\"headline\":\"Recursive Enumerations in Swift\",\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/piyush-george\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"\\\/blog\\\/wp-ttn-blog\\\/uploads\\\/2017\\\/06\\\/Screen-Shot-2017-06-28-at-10.45.00-AM.png\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/recursive-enumerations-in-swift\\\/#articleImage\"},\"datePublished\":\"2017-08-01T09:31:28+05:30\",\"dateModified\":\"2022-01-13T14:11:15+05:30\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/recursive-enumerations-in-swift\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/recursive-enumerations-in-swift\\\/#webpage\"},\"articleSection\":\"iOS, Software development, Technology, iOS, Keyword, recursion, Recursive enum, swift, swift 3, Swift Enum, Image\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/recursive-enumerations-in-swift\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"name\":\"Technology\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"position\":2,\"name\":\"Technology\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/recursive-enumerations-in-swift\\\/#listItem\",\"name\":\"Recursive Enumerations in Swift\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/recursive-enumerations-in-swift\\\/#listItem\",\"position\":3,\"name\":\"Recursive Enumerations in Swift\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"name\":\"Technology\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\",\"name\":\"TO THE NEW Blog\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/piyush-george\\\/#author\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/piyush-george\\\/\",\"name\":\"Piyush George\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/recursive-enumerations-in-swift\\\/#authorImage\",\"url\":\"https:\\\/\\\/newersworld-sf-static.tothenew.net\\\/prod\\\/profilePicFolder\\\/858ebf2c-6f0a-4372-94cb-935d6bc3592d_1549-Piyush-George-PROFILEPICTURE.jpeg\",\"width\":96,\"height\":96,\"caption\":\"Piyush George\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/recursive-enumerations-in-swift\\\/#webpage\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/recursive-enumerations-in-swift\\\/\",\"name\":\"Recursive Enumerations in Swift | TO THE NEW Blog\",\"description\":\"The blog describes what is recursive and what is its importance with the help of few examples.\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/recursive-enumerations-in-swift\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/piyush-george\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/piyush-george\\\/#author\"},\"datePublished\":\"2017-08-01T09:31:28+05:30\",\"dateModified\":\"2022-01-13T14:11:15+05:30\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\",\"name\":\"TO THE NEW Blog\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Recursive Enumerations in Swift | TO THE NEW Blog","description":"The blog describes what is recursive and what is its importance with the help of few examples.","canonical_url":"https:\/\/2thenew.online\/blog\/recursive-enumerations-in-swift\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/2thenew.online\/blog\/recursive-enumerations-in-swift\/#article","name":"Recursive Enumerations in Swift | TO THE NEW Blog","headline":"Recursive Enumerations in Swift","author":{"@id":"https:\/\/2thenew.online\/blog\/author\/piyush-george\/#author"},"publisher":{"@id":"https:\/\/2thenew.online\/blog\/#organization"},"image":{"@type":"ImageObject","url":"\/blog\/wp-ttn-blog\/uploads\/2017\/06\/Screen-Shot-2017-06-28-at-10.45.00-AM.png","@id":"https:\/\/2thenew.online\/blog\/recursive-enumerations-in-swift\/#articleImage"},"datePublished":"2017-08-01T09:31:28+05:30","dateModified":"2022-01-13T14:11:15+05:30","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/2thenew.online\/blog\/recursive-enumerations-in-swift\/#webpage"},"isPartOf":{"@id":"https:\/\/2thenew.online\/blog\/recursive-enumerations-in-swift\/#webpage"},"articleSection":"iOS, Software development, Technology, iOS, Keyword, recursion, Recursive enum, swift, swift 3, Swift Enum, Image"},{"@type":"BreadcrumbList","@id":"https:\/\/2thenew.online\/blog\/recursive-enumerations-in-swift\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/2thenew.online\/blog#listItem","position":1,"name":"Home","item":"https:\/\/2thenew.online\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/2thenew.online\/blog\/category\/technology\/#listItem","name":"Technology"}},{"@type":"ListItem","@id":"https:\/\/2thenew.online\/blog\/category\/technology\/#listItem","position":2,"name":"Technology","item":"https:\/\/2thenew.online\/blog\/category\/technology\/","nextItem":{"@type":"ListItem","@id":"https:\/\/2thenew.online\/blog\/recursive-enumerations-in-swift\/#listItem","name":"Recursive Enumerations in Swift"},"previousItem":{"@type":"ListItem","@id":"https:\/\/2thenew.online\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/2thenew.online\/blog\/recursive-enumerations-in-swift\/#listItem","position":3,"name":"Recursive Enumerations in Swift","previousItem":{"@type":"ListItem","@id":"https:\/\/2thenew.online\/blog\/category\/technology\/#listItem","name":"Technology"}}]},{"@type":"Organization","@id":"https:\/\/2thenew.online\/blog\/#organization","name":"TO THE NEW Blog","url":"https:\/\/2thenew.online\/blog\/"},{"@type":"Person","@id":"https:\/\/2thenew.online\/blog\/author\/piyush-george\/#author","url":"https:\/\/2thenew.online\/blog\/author\/piyush-george\/","name":"Piyush George","image":{"@type":"ImageObject","@id":"https:\/\/2thenew.online\/blog\/recursive-enumerations-in-swift\/#authorImage","url":"https:\/\/newersworld-sf-static.tothenew.net\/prod\/profilePicFolder\/858ebf2c-6f0a-4372-94cb-935d6bc3592d_1549-Piyush-George-PROFILEPICTURE.jpeg","width":96,"height":96,"caption":"Piyush George"}},{"@type":"WebPage","@id":"https:\/\/2thenew.online\/blog\/recursive-enumerations-in-swift\/#webpage","url":"https:\/\/2thenew.online\/blog\/recursive-enumerations-in-swift\/","name":"Recursive Enumerations in Swift | TO THE NEW Blog","description":"The blog describes what is recursive and what is its importance with the help of few examples.","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/2thenew.online\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/2thenew.online\/blog\/recursive-enumerations-in-swift\/#breadcrumblist"},"author":{"@id":"https:\/\/2thenew.online\/blog\/author\/piyush-george\/#author"},"creator":{"@id":"https:\/\/2thenew.online\/blog\/author\/piyush-george\/#author"},"datePublished":"2017-08-01T09:31:28+05:30","dateModified":"2022-01-13T14:11:15+05:30"},{"@type":"WebSite","@id":"https:\/\/2thenew.online\/blog\/#website","url":"https:\/\/2thenew.online\/blog\/","name":"TO THE NEW Blog","inLanguage":"en-US","publisher":{"@id":"https:\/\/2thenew.online\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"TO THE NEW BLOG","og:type":"blog","og:title":"Recursive Enumerations in Swift | TO THE NEW Blog","og:description":"The blog describes what is recursive and what is its importance with the help of few examples.","og:url":"https:\/\/2thenew.online\/blog\/recursive-enumerations-in-swift\/","og:image":"https:\/\/2thenew.online\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","og:image:secure_url":"https:\/\/2thenew.online\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","twitter:card":"summary","twitter:site":"@tothenew","twitter:title":"Recursive Enumerations in Swift | TO THE NEW Blog","twitter:description":"The blog describes what is recursive and what is its importance with the help of few examples.","twitter:image":"https:\/\/2thenew.online\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png"},"aioseo_meta_data":{"post_id":"49708","title":"Recursive Enumerations in Swift | #site_title","description":"The blog describes what is recursive and what is its importance with the help of few examples.","keywords":[],"keyphrases":{"focus":[],"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"blog","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":[],"twitter_use_og":false,"twitter_card":"summary","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":{"id":"#aioseo-article-65e0401856583","slug":"article","graphName":"Article","label":"Article","properties":{"type":"BlogPosting","name":"#post_title","headline":"#post_title","description":"#post_excerpt","image":"","keywords":"","author":{"name":"#author_name","url":"#author_url"},"dates":{"include":true,"datePublished":"","dateModified":""}}},"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":"{\"article\":{\"articleType\":\"BlogPosting\"},\"course\":{\"name\":\"\",\"description\":\"\",\"provider\":\"\"},\"faq\":{\"pages\":[]},\"product\":{\"reviews\":[]},\"recipe\":{\"ingredients\":[],\"instructions\":[],\"keywords\":[]},\"software\":{\"reviews\":[],\"operatingSystems\":[]},\"webPage\":{\"webPageType\":\"WebPage\"}}","pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"limit_modified_date":false,"created":"2021-04-29 12:18:08","updated":"2024-02-29 08:28:08","focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/2thenew.online\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/2thenew.online\/blog\/category\/technology\/\" title=\"Technology\">Technology<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tRecursive Enumerations in Swift\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/2thenew.online\/blog"},{"label":"Technology","link":"https:\/\/2thenew.online\/blog\/category\/technology\/"},{"label":"Recursive Enumerations in Swift","link":"https:\/\/2thenew.online\/blog\/recursive-enumerations-in-swift\/"}],"_links":{"self":[{"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/posts\/49708","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/users\/1072"}],"replies":[{"embeddable":true,"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/comments?post=49708"}],"version-history":[{"count":1,"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/posts\/49708\/revisions"}],"predecessor-version":[{"id":54646,"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/posts\/49708\/revisions\/54646"}],"wp:attachment":[{"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/media?parent=49708"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/categories?post=49708"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/tags?post=49708"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}