{"id":593,"date":"2026-09-05T18:55:59","date_gmt":"2026-09-05T18:55:59","guid":{"rendered":"https:\/\/x.sheep-mine.ts.net\/index.php\/52032917-kodebits-day-86-computed-property\/"},"modified":"2026-09-05T18:55:59","modified_gmt":"2026-09-05T18:55:59","slug":"52032917-kodebits-day-86-computed-property","status":"publish","type":"post","link":"https:\/\/x.sheep-mine.ts.net\/index.php\/52032917-kodebits-day-86-computed-property\/","title":{"rendered":"Kodebits Day 86: Computed Property"},"content":{"rendered":"<p><br \/>\n<\/p>\n<div>\n<h2 id=\"toc-anchor-001\">What is the output?<\/h2>\n<pre lang=\"swift\">\r\nstruct Rect {\r\n  var width: Int\r\n  var height: Int\r\n  var area: Int {\r\n    return width * height\r\n  }\r\n}\r\nlet r = Rect(width: 4, height: 5)\r\nprint(r.area)\r\n<\/pre>\n<p>\n  <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/swiftfiddle.com\/0c88bb3581bc9632fa1b5c03021a0c11\" target=\"_blank\" rel=\"noopener noreferrer\"><br \/>Try it in the online Swift Playground \u2192<br \/><\/a>\n<\/p>\n<p>[spoiler title=&#8221;Solution&#8221;]<\/p>\n<h3 id=\"toc-anchor-002\">Answer:<\/h3>\n<pre>\r\n20\r\n<\/pre>\n<h3 id=\"toc-anchor-003\">Explanation:<\/h3>\n<p>Computed properties calculate values on access rather than storing them.<\/p>\n<p>[\/spoiler]<\/p>\n<hr\/>\n<h3 id=\"toc-anchor-004\">Further Reading<\/h3>\n<\/p><\/div>\n<p><br \/>\n<br \/><a href=\"https:\/\/www.kodeco.com\/52032917-kodebits-day-86-computed-property\">Source link <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is the output? struct Rect { var width: Int var height: Int var area:&#8230;<\/p>\n","protected":false},"author":1,"featured_media":594,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1322,1321],"tags":[],"class_list":["post-593","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-article","category-free"],"_links":{"self":[{"href":"https:\/\/x.sheep-mine.ts.net\/index.php\/wp-json\/wp\/v2\/posts\/593","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/x.sheep-mine.ts.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/x.sheep-mine.ts.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/x.sheep-mine.ts.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/x.sheep-mine.ts.net\/index.php\/wp-json\/wp\/v2\/comments?post=593"}],"version-history":[{"count":0,"href":"https:\/\/x.sheep-mine.ts.net\/index.php\/wp-json\/wp\/v2\/posts\/593\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/x.sheep-mine.ts.net\/index.php\/wp-json\/wp\/v2\/media\/594"}],"wp:attachment":[{"href":"https:\/\/x.sheep-mine.ts.net\/index.php\/wp-json\/wp\/v2\/media?parent=593"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/x.sheep-mine.ts.net\/index.php\/wp-json\/wp\/v2\/categories?post=593"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/x.sheep-mine.ts.net\/index.php\/wp-json\/wp\/v2\/tags?post=593"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}