{"id":131,"date":"2017-01-17T09:29:11","date_gmt":"2017-01-17T08:29:11","guid":{"rendered":"http:\/\/www.hudelist.org\/?p=131"},"modified":"2019-11-24T12:39:48","modified_gmt":"2019-11-24T11:39:48","slug":"getting-version-information-in-swift","status":"publish","type":"post","link":"https:\/\/www.hudelist.org\/?p=131","title":{"rendered":"Getting version information in SWIFT"},"content":{"rendered":"<p dir=\"auto\">Often you need to extract version and build information, e.g. to display in an info-box. This short code snippet extracts this information for you and sets an appropriate label.<\/p>\n<pre>\/\/ Get version info and set version label\nlet dictionary = Bundle.main.infoDictionary!\nlet version = dictionary[\"CFBundleShortVersionString\"] as! String\nlet build = dictionary[\"CFBundleVersion\"] as! String\nself.versionLabel.text = \"Version \\(version) Build \\(build)\"<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Often you need to extract version and build information, e.g. to display in an info-box. This short code snippet extracts this information for you and sets an appropriate label. \/\/ Get version info and set version label let dictionary = Bundle.main.infoDictionary! let version = dictionary[&#8220;CFBundleShortVersionString&#8221;] as! String let build = dictionary[&#8220;CFBundleVersion&#8221;] as! String self.versionLabel.text = &#8220;Version \\(version) Build \\(build)&#8221;<\/p>\n","protected":false},"author":1,"featured_media":183,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,6],"tags":[4],"class_list":["post-131","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-coding","category-swift","tag-ios"],"_links":{"self":[{"href":"https:\/\/www.hudelist.org\/index.php?rest_route=\/wp\/v2\/posts\/131","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hudelist.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hudelist.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hudelist.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hudelist.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=131"}],"version-history":[{"count":2,"href":"https:\/\/www.hudelist.org\/index.php?rest_route=\/wp\/v2\/posts\/131\/revisions"}],"predecessor-version":[{"id":149,"href":"https:\/\/www.hudelist.org\/index.php?rest_route=\/wp\/v2\/posts\/131\/revisions\/149"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hudelist.org\/index.php?rest_route=\/wp\/v2\/media\/183"}],"wp:attachment":[{"href":"https:\/\/www.hudelist.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=131"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hudelist.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=131"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hudelist.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=131"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}