<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Remember - Medium]]></title>
        <description><![CDATA[An iOS app to remember the last time you did something, by @nicolasbichon and @jeromedieu. - Medium]]></description>
        <link>https://medium.com/remember-app?source=rss----a0bfaa246b89---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Remember - Medium</title>
            <link>https://medium.com/remember-app?source=rss----a0bfaa246b89---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 00:21:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/remember-app" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Creating an abstraction layer for the model]]></title>
            <link>https://medium.com/remember-app/creating-an-abstraction-layer-for-the-model-e16c643a8a62?source=rss----a0bfaa246b89---4</link>
            <guid isPermaLink="false">https://medium.com/p/e16c643a8a62</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[layers]]></category>
            <category><![CDATA[model]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[abstraction]]></category>
            <dc:creator><![CDATA[Nicolas Bichon]]></dc:creator>
            <pubDate>Mon, 04 Feb 2019 12:53:59 GMT</pubDate>
            <atom:updated>2019-02-08T23:16:06.744Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bS3bWOJDVSP7N2P6" /><figcaption>Photo by <a href="https://unsplash.com/@hasanalmasi?utm_source=medium&amp;utm_medium=referral">Hasan Almasi</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Have you ever seen different layers for the model in iOS development? I never have. When using Core Data for example, we usually manipulate NSManagedObject directly in the view. That’s not ideal. So for once, I looked at how I could create an abstraction layer for the model.</p><h3>Why another model?</h3><p>I’m using <a href="https://twitter.com/rememberlastime/status/1088076164030230528">Core Data to store the data</a> in our app <a href="http://remember-app.co/">Remember</a>. To create a Core Data model, I need to inject a NSManagedObjectContext object in the NSManagedObject constructor. The problem is I don’t want to have to pass around the context object everywhere in the app. I want it to be <strong>isolated</strong> in the model layer. And I want to manipulate <strong>simple</strong> <strong>POSOs</strong> (Plain Old Swift Object) in the business layer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/456/1*0wAAQmwR_wiOM5a3A_FuFQ.png" /></figure><p>To do that, I need a way to translate my NSManagedObject objects into business objects and vice versa.</p><p>Also, my database objects should not know my business objects. By doing so, I could easily replace Core Data with another database provider, without impacting the rest of the codebase. This idea is inspired from the <a href="http://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html">Clean Architecture</a>.</p><h3>Business and model layers</h3><p>In our app <a href="http://remember-app.co/">Remember</a>, I only have one table to store the last times a user did something. Pretty simple.</p><p>I created an Event class in my business layer. This is the object I will manipulate in the views.</p><p>For the model layer, I created an EventManagedObject class, which inherits from NSManagedObject.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/456/1*UlY5J00LOetBd6eVNq0DZg.png" /><figcaption>Each layer has its own representation of the Event entity</figcaption></figure><h3>From one model to another</h3><p>To convert the objects in both directions, I created an ObjectConvertible protocol, implemented by the Event class.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/587237f26d5b1724605467182d81869f/href">https://medium.com/media/587237f26d5b1724605467182d81869f/href</a></iframe><p>The identifier is used to fetch the corresponding NSManagedObject, if there is one.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/564619d447dc2a84b44fa6337cd5be49/href">https://medium.com/media/564619d447dc2a84b44fa6337cd5be49/href</a></iframe><p>Then I created a ManagedObjectConvertible protocol.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fbbcb4b8cc0d5bc42fed5f84ef25f716/href">https://medium.com/media/fbbcb4b8cc0d5bc42fed5f84ef25f716/href</a></iframe><p>Because I didn’t want to rewrite the same code in each NSManagedObject subclass which implements this protocol, I wrote a <strong>protocol extension</strong> where most of the job is done. This is where the magic happens.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8a0681e272d216a1bef45f681567d1a0/href">https://medium.com/media/8a0681e272d216a1bef45f681567d1a0/href</a></iframe><p>This protocol is implemented by the EventManagedObject class.</p><p>Thanks to the protocol extension, I have only <strong>two methods </strong>left to implement. Those are the methods that transfer the business object’s data to the database object’s data and vice versa.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8caee2f37d4b621bd896ffc58bc49c66/href">https://medium.com/media/8caee2f37d4b621bd896ffc58bc49c66/href</a></iframe><h4>CRUD operations</h4><p>It is now super easy to perform operations on the Event object, without manipulating NSManagedObject objects directly.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9e571b0954823da8608417c8d5e2cbe2/href">https://medium.com/media/9e571b0954823da8608417c8d5e2cbe2/href</a></iframe><h3>Store</h3><p>At the beginning of this article, I said I didn’t want to have to pass a NSManagedObjectContext object throughout the code.</p><p>To isolate the context, I created an EventStore class, which keeps a reference on the NSManagedObjectContext object.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6060258b0cc42a00aff74932c1420a71/href">https://medium.com/media/6060258b0cc42a00aff74932c1420a71/href</a></iframe><p>The store can then be used in a view controller, or a view model for example.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/94b07db7fd0a25993c4186c3d4368dae/href">https://medium.com/media/94b07db7fd0a25993c4186c3d4368dae/href</a></iframe><p>The business layer uses the store to perform operations on the business objects. It doesn’t know where the objects are stored, it could be in Core Data, Realm or even in files. This is my abstraction layer.</p><h3>Downsides</h3><p>Even though this method provides some comfort when working with model objects, it has some downsides.</p><p>The biggest one is I can’t use Core Data’s built-in <strong>lazy loading</strong> system or <strong>NSFetchedResultsController</strong>. If I wanted to use it, I would have to create my own pagination system.</p><p>Dealing with <strong>relationships</strong> is also not implemented in this solution. Even though I didn’t investigate it, the conversion of the nested objects would probably be in the from(object: T) and toObject() -&gt; T implementation methods.</p><h3>Final thoughts</h3><p>I managed to do what I initially wanted, the Event class is totally <strong>agnostic</strong> of the EventManagedObject class.</p><p>I’m manipulating <strong>simple objects</strong> in the views.</p><p>And the model layer is <strong>isolated</strong> from the rest of the application. I could definitely replace Core Data with another database provider, without impacting the rest of the codebase.</p><p>The only thing left is to handle <strong>Core Data errors</strong>. Something I will definitely do in the app.</p><p>I honestly never worked on an app that had an abstraction layer for the model. Like I said, it’s not common in the iOS world, from my experience at least. But I’m super happy with the result and <a href="https://github.com/papercones/remember">I will definitely use it in Remember</a>.</p><p>Any feedback is welcome!</p><p><em>A big thank you to </em><a href="https://twitter.com/werck_a"><em>Ayrton</em></a><em> for his help.</em></p><p><a href="http://remember-app.co/"><em>Remember</em></a><em> is an iOS app developed by </em><a href="https://twitter.com/nicol3a"><em>Nicolas Bichon</em></a><em> and </em><a href="https://twitter.com/jeromedieu"><em>Jérôme Dieu</em></a><em>. We share everything that happens during the creation of the app on Twitter. </em><a href="https://twitter.com/rememberlastime"><em>Follow us</em></a><em> on this journey!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e16c643a8a62" width="1" height="1" alt=""><hr><p><a href="https://medium.com/remember-app/creating-an-abstraction-layer-for-the-model-e16c643a8a62">Creating an abstraction layer for the model</a> was originally published in <a href="https://medium.com/remember-app">Remember</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[(Re)starting our personal project]]></title>
            <link>https://medium.com/remember-app/re-starting-our-personal-project-45532c3a320d?source=rss----a0bfaa246b89---4</link>
            <guid isPermaLink="false">https://medium.com/p/45532c3a320d</guid>
            <category><![CDATA[launch]]></category>
            <category><![CDATA[personal-project]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Nicolas Bichon]]></dc:creator>
            <pubDate>Thu, 31 Jan 2019 17:54:02 GMT</pubDate>
            <atom:updated>2019-02-01T18:15:29.890Z</atom:updated>
            <content:encoded><![CDATA[<p>Working on personal projects is hard, even more when we already have a full-time job. I worked on countless of unfinished personal projects. Today we’re (re)starting a new one, <a href="https://twitter.com/nicol3a">me</a> and my friend <a href="https://twitter.com/jeromedieu">Jérôme</a>.</p><h3>A bit of history</h3><p>Back in December 2013, I had the idea of creating an iOS app that would help me remember the last time I did something. Jérôme and I were already working together in the same company in Brussels. He’s a designer, I’m an iOS developer, so we decided to team up to create this app, forming the Papercones collective.</p><p>Jérôme came up with a <a href="https://dribbble.com/shots/1321839-Next-app-icon">colorful design</a> that was doing the job very well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YJikdW14yRufTv60HQN63Q.png" /><figcaption>The original design made in 2013 (refreshed in 2015)</figcaption></figure><p>We finished the app in a few months and we were almost ready to ship it. Then the iPhone 6 came out with a new screen resolution. Unfortunately we never took the time to adapt the app for it. At that time I had also just moved to another job, which is always is big disruption. Time passing, we stopped working on it.</p><p>5 years later, it’s finally time to work on it again. And finish it this time.</p><h3>What’s the plan?</h3><p>My idea to be sure we have no choice but to finish the app, is to <strong>share</strong> <strong>everything we do and think</strong> during the creation process (the technical / design choices we make, how we work, our motivation to work on a personal project after work, the business model, etc.).</p><p>I really think it’s interesting for people who want to know how an app is designed. It’s also going to force us to go all the way.</p><ol><li>We will <strong>refresh the UI</strong>. Jérôme made the design in December 2013, it was 5 years ago. Things have changed a lot since then.</li><li>We will <strong>re-develop the app</strong> from scratch, in Swift. The code was originally written in Objective-C and I was still a junior developer then. Swift is out now and the code I write today is completely different. I even write unit tests (gasp!).</li><li>The code will be <strong>Open Source</strong>,<strong> </strong>the <a href="https://github.com/papercones/remember">public Github repository</a> is already available. We will push commits <strong>throughout the development</strong> of the app.</li><li>We will share daily what happens during the creation of the app on <a href="https://twitter.com/rememberlastime"><strong>Twitter</strong></a>, and big milestones on <a href="http://medium.com/rememberthelasttime"><strong>Medium</strong></a>.</li></ol><p>It’ll be fun! Join us on this journey!</p><p><a href="http://remember-app.co/"><em>Remember</em></a><em> is an iOS app developed by </em><a href="https://twitter.com/nicol3a"><em>Nicolas Bichon</em></a><em> and </em><a href="https://twitter.com/jeromedieu"><em>Jérôme Dieu</em></a><em>. We share everything that happens during the creation of the app on Twitter. </em><a href="https://twitter.com/rememberlastime"><em>Follow us</em></a><em> on this journey!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=45532c3a320d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/remember-app/re-starting-our-personal-project-45532c3a320d">(Re)starting our personal project</a> was originally published in <a href="https://medium.com/remember-app">Remember</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>