<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Codable on dev.endevour</title><link>https://devendevour.iankulin.com/tags/codable/</link><description>Recent content in Codable on dev.endevour</description><generator>Hugo</generator><language>en-AU</language><lastBuildDate>Mon, 31 Oct 2022 00:00:00 +0000</lastBuildDate><atom:link href="https://devendevour.iankulin.com/tags/codable/index.xml" rel="self" type="application/rss+xml"/><item><title>Codable when the keys don't match</title><link>https://devendevour.iankulin.com/codable-when-the-keys-dont-match/</link><pubDate>Mon, 31 Oct 2022 00:00:00 +0000</pubDate><guid>https://devendevour.iankulin.com/codable-when-the-keys-dont-match/</guid><description>&lt;p&gt;&lt;img src="https://devendevour.iankulin.com/images/medieval-door-lock-detailed-drawing.jpg" alt="" class="img-responsive"&gt; &lt;/p&gt;
&lt;p&gt;A common issue when working with JSON that you vacuum up from internet APIs will be that the key names in the JSON don&amp;rsquo;t match your property names. The JSON de facto standard of using snake_case in key names could be one cause, or perhaps you just take &lt;a href="https://www.freshconsulting.com/insights/blog/development-principle-1-choose-appropriate-variable-names/" target="_blank" rel="noopener"&gt;variable naming more seriously&lt;/a&gt; than the person who wrote the API.&lt;/p&gt;
&lt;p&gt;We saw yesterday how using codable and the JSONEncoder in Swift makes moving between an object/struct in the code and a stringish representation of it simple. With a couple of small changes, we can also deal with the mismatched key/property name issue.&lt;/p&gt;</description></item><item><title>JSON encode/decode</title><link>https://devendevour.iankulin.com/json-encode-decode/</link><pubDate>Mon, 24 Oct 2022 00:00:00 +0000</pubDate><guid>https://devendevour.iankulin.com/json-encode-decode/</guid><description>&lt;p&gt;&lt;img src="https://devendevour.iankulin.com/images/img_3110.png" alt="Screenshop of Habits app" class="img-responsive"&gt; &lt;/p&gt;
&lt;p&gt;As usual, I&amp;rsquo;m spending way more time on the apps written from scratch in the &lt;a href="https://www.hackingwithswift.com/guide/ios-swiftui/4/3/challenge" target="_blank" rel="noopener"&gt;100Days series&lt;/a&gt; . The Habit tracking app I&amp;rsquo;m working on has been good practice, especially of the architecture of the simple &lt;a href="https://devendevour.iankulin.com/list-apps/"&gt;list based app&lt;/a&gt; .&lt;/p&gt;
&lt;p&gt;My version has a couple of refinements I quite like. I&amp;rsquo;m using a checkmark in a rectangle as the button to mark that activity as done, and I&amp;rsquo;ve added a nice fade to the checkmark as time goes on to represent the percentage of time from when it is done until it becomes due again.&lt;/p&gt;</description></item></channel></rss>