<?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[Stories by Andrew Eades on Medium]]></title>
        <description><![CDATA[Stories by Andrew Eades on Medium]]></description>
        <link>https://medium.com/@andy_41059?source=rss-d4cef048fdd4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*V6s_AARhfCRg_LWJ.</url>
            <title>Stories by Andrew Eades on Medium</title>
            <link>https://medium.com/@andy_41059?source=rss-d4cef048fdd4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 14:51:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@andy_41059/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Thinking Through Code]]></title>
            <link>https://medium.com/@andy_41059/thinking-through-code-663100ef19d1?source=rss-d4cef048fdd4------2</link>
            <guid isPermaLink="false">https://medium.com/p/663100ef19d1</guid>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[action]]></category>
            <category><![CDATA[extension]]></category>
            <dc:creator><![CDATA[Andrew Eades]]></dc:creator>
            <pubDate>Thu, 11 Jan 2018 19:31:55 GMT</pubDate>
            <atom:updated>2018-01-11T19:31:55.521Z</atom:updated>
            <content:encoded><![CDATA[<p>“Refactoring” is a term often bandied about when coders really mean “rewriting”. I think refactoring specifically requires a set of tests to demonstrate that the code continues to look the same from the outside even though the insides have changed dramatically. i.e. the tests pass before and after each refactoring step.</p><p>There’s a lot you can read up on on the ideas of Refactoring and Test Driven Development in particular but there do not seem to be many demonstrations of how to do it. After spending a good few hours deciphering and understanding Apple’s own Action Extension template code, I thought it would be good to show my thinking process as a demo of trying to understand somebody else’s code and reworking it into something usable. I will also take the opportunity to correct some dreadful naming and improve upon the coding techniques used to take advantage of more Swifty features. This isn’t really Refactoring but it is Thinking Through Code. The test is “can I see the expected image?”</p><p>I’m writing this post as I do it so open up Xcode 9 and let’s get cracking…</p><p>First, create a New Project. Choose a Single View App and call it ActionExtensionDemo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*i7Av5Sg2tN3CmtshMIzHgg.png" /><figcaption>Your project navigator files should look like this now</figcaption></figure><p>Add a New Target, select Action Extension and call it ActionExtension In the next dialog, do <strong>not</strong> Activate the ActionExtension Scheme. Press Cancel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*6p1FMgqeAWU-Yai5M6WHHQ.png" /><figcaption>The ActionExtension files have been added</figcaption></figure><p>Build and run and you get an app with a blank white screen. Fat lot of use that is. This is because the main target app is just a container for the Action Extension which is what we are really interested in. It is an extesnion that expects an image so go to Photos, select an image and tap the share icon in the bottom left.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/425/1*UnXSbtqN557CkNgc5aqLHA.png" /></figure><p>After tapping the share icon, you will se a row of grey icons at the bottom of the screen. these are Actions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/425/1*FWrsk09bmLAmJGmNvShV1Q.png" /></figure><p>Our Action is hidden anyaway inside the More menu at the far right of the bottom row. Swipe left until you reveal it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/425/1*UR5qtFdR0_yeGeTRgFzYog.png" /></figure><p>After tapping More, we now have to scroll down to find our ActionExtension.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/425/1*ju069w4I0lbpJdPL-boFXw.png" /></figure><p>Now switch it on and drag it to the top…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/425/1*k0zA4EalwdW7CU5J0Kwr2g.png" /></figure><p>Tap Done to make the ActionExtension available to use from other apps. When you tap the share icon our faceless extension is available for use. Tap it and it will show a view containing the image. Voila. The Apple template works. We can modify it for our own purposes. Before being able to do that we should try to understand it. Have a look ActionViewController.swift in Xcode.</p><p>It’s obscure stuff to say the least. And it’s buggy:</p><ol><li>Done button does not work after using on a photo in Photos, forcing user to force quit Photos.</li><li>Does not show image when used from Twitter app. But Done does work in this case.</li></ol><p>This is not an auspicious start. The 63 lines of code provided by Apple in ActionViewController.swift don’t seem to work well…</p><h3>Let’s Log</h3><p>So how to deal with this? Normally, I’d step through the code but as this an extension that seems hard to do. So we are left with one of the most primitive tools a coder has: print stuff out. But again as we can’t easily attach a debugger this is also hard. Until we remember about the Console app on the Mac. Type “Console” into spotlight and open the app. You can select various devcies to see a log of what is going on in each. Apple engineers aren’t afraid of spamming this with NSLog() so we will have to filter out for messages we are interested in.</p><p>In the ActionExtension group, add an empty Swift file called, ConsoleLogger.swift. Let’s create a ConsoleLogging protocol and extend it with some default functionality.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/079f70fcde8d5e9968f9515069fabd88/href">https://medium.com/media/079f70fcde8d5e9968f9515069fabd88/href</a></iframe><p>We are simply facading NSLog() for this example. Now we make the ActionViewController adopt ConsoleLogging by adding the following to the end of ActionViewController.swift:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/91e09aaf16e6c49e9ece19ee6a7544b9/href">https://medium.com/media/91e09aaf16e6c49e9ece19ee6a7544b9/href</a></iframe><p>One of the things I love about Swift is that we can extend exisitng code easily like this.</p><p>Let’s start logging messages to the console and filtering them out by filtering for messages with “[ActionExtensionDemo]” in them.</p><p>Make the first line of viewDidLoad() in ActionViewController.swift log a message:</p><pre>log(&quot;viewDidLoad&quot;)</pre><p>Now build and run the app in an emulator, go to the Photos app and display a photo in the Action Extension. Set your search in the Console app to search for the first characters of “[ActionExtensionDemo]” until you are satisifed that you have made contact. You should see somehting like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GSTcIDu23dpU5zj9CJFC0A.png" /><figcaption>Console app filtering for messages from our ActionExtensionDemo</figcaption></figure><h3>Done is Done</h3><p>The first thing to do is to fix it so that you can exit Photos after using the extension without having to force quit. Adding a log message in the done() function of ActionViewController confirms that the Done button is not responsive if an image loaded successfully. But if you try to use the Action on a non-image, say a News article, the Done button works as expected.</p><p>I tried rewiring in Interface Builder and adding another item to the Navigation Bar that triggers the same done() action but to no avail. Navigation Bars are on their way out as a UI element as the top of the screen is increasingly hard to reach so I decided to ditch it in favour of a Toolbar at the bottom of the screen.</p><p>Add a Toolbar at the bootom of the screen and drag the Done button onto it. Now delete the Navigation Bar and move the Image View up and resize to fit.</p><p>At this point, Autoulayout is probably going to complain so delete the constraints and add new ones as follows:</p><ol><li>Pin the Toolbar to the bottom and sides of the Safe Area.</li><li>Pin the Image View’s bottom to the top of the Toolbar.</li><li>Pin the Image View to the top and sides of the Safe Area.</li></ol><p>You should end up with interface builder looking like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NSRsWrD-kcTjzxSBNf6pSg.png" /></figure><p>With no code editing, we have fixed the the Done button! I’m not at all certain why this didn’t work in Apple’s template code but it is working now so I guess we’ll have to accept this. (Please let me know if you have some intel on why the Navigation Bar stopped accepting input in the first place.)</p><p>I actually want to be able to use my Action Extension from within the Twitter app so it’s no good if this doesn’t work. Try sharing an image from Twitter and using this extension. The image does not show. It took me ages to figure out why and I will show no mercy in blaming the culprit when we come to it. But with the hindsight I have gained, let’s take a look at the code and see if we can simplify or make sense of it.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/55de60c4c13b9616381bdc4449892c38/href">https://medium.com/media/55de60c4c13b9616381bdc4449892c38/href</a></iframe><p>This code just looks like trouble to me. The relentless marching to the right, the forced unwraps using <em>!</em>, the <em>imageFound</em> flag. These are all bad code smells to me. There’s some async code in there as well for loading the image into the image view and no error handling. Hmm. Where to start?</p><p>When I originally did this I was not as methodical as I’m about to be. And I suffered from that. I’m going to simplify this code first, add error handling and then see if we can get it to work how I want.</p><p>To get rid of the nested for loops and if statements we need to draw on Swift’s more functional concepts. That is, we are going to use map, flatMap, and filter to help us out here.</p><p>First let’s extract the code at the centre of the fors and ifs into a method so we can focus on the flow:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6721595e3b523ebb19078c22bee53890/href">https://medium.com/media/6721595e3b523ebb19078c22bee53890/href</a></iframe><p>You can do most of this using Xcode’s Refactor/Extract method but you have to move the <em>weakImageView = self.imageView</em> line up and I changed the signature of the function as well by adding <em>from</em>.</p><p>Our viewDidLoad() now looks like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1543ba218a862519c5980959fe40f3b0/href">https://medium.com/media/1543ba218a862519c5980959fe40f3b0/href</a></iframe><p>There is still a lot of stuff hanging right out there. Let’s get rid of the loops. Basically, the loops are iterating over a list of NSItemProviders that come as attachments to the list of NSExtensionItems. So we have 2 nested for loops to iterate over all potential NSItemProviders.</p><p>I’m going to replace it all in one fell swoop and remove the need for the imageFound flag. And make it much safer code to boot.</p><p>Here’s the new viewDidLoad():</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/80b967fb03952da5a1e1a89c5f2ae658/href">https://medium.com/media/80b967fb03952da5a1e1a89c5f2ae658/href</a></iframe><p>Simple, eh?</p><p>What we’ve done here is express the original coder’s intent as a mapping of the inputItems array into a single image provider and then called loadItem() on that. Rather than use lots imperative code which leads to too many opening braces, we’ve taken a much more declarative approach.</p><p>We’ve said that:</p><ul><li>The attachments are all the extension items’ attachments (using flatMap).</li><li>The imageProviders are the attachments as ItemProviders of images.</li><li>We are only interested in the first image provider’s image.</li></ul><p>We don’t need the <em>imageFound</em> flag nor do we need to break out of nested loops. We use mappings and filters to reduce the initial inputItems array until it is just one item that we know is an image provider.</p><p>We also remove nil pointers by filtering them out and then unwrapping the optionals that are left.</p><p>I’ve also used <em>guard…let…else </em>statements to check for error conditions.</p><p>I’m happy that this code is better and that I’ve understood the previous version enough to “refactor” it. Now for the massive gotcha.</p><p>One thing a compiler can’t do yet and tests can’t help with is bad naming. It took me quite a while to work this one out but here it is:</p><pre>private func loadImage(from imageURL: NSSecureCoding?)</pre><p>Remember that I refactored this from the original code but the error was brought along into the refactoring. Actually, it was doing this refactoring (way too late) that made it more obvious to me.</p><p>The variable passed as “imageURL” is not an image’s URL, it’s not even a URL. It’s type is NSSecureCoding? and it is cast to a URL within the function, silently failing if it isn’t castable. With all the forced unwrapping going on previously this was easy to miss as just a way to get from the older Objective-C NS-APIs to Swift. The easy assumption to make at this point is that the only possible value that can be handled here would be an image’s URL. How else could it have made it through the checks against <em>kUTTypeImage?</em> It turns out that this is a terrible assumption to make.</p><p>Rather than fail silently, we should let the user know.</p><p>Add this extension to the bottom of ActionViewController.swift.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0b0e03ba3a86152cb902bd641e5a07ca/href">https://medium.com/media/0b0e03ba3a86152cb902bd641e5a07ca/href</a></iframe><p>This is a helper function to show an alert message and optionally cause it to dismiss the Action Extension when the alert is seen by the user. This is the most common case as it is likley an error so we set a deafult value of <em>true</em> for <em>shouldCloseExtensionWithAlertDismissal</em>.</p><p>Now we add a call to showAlert() to everywhere that we see a return statement in the code as we are only returning prematurely if we hit a problem.</p><p>And we refactor loadImage() a bit so we can test it’s argument is a URL before carrying on. We end up with this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6c6340b9748ac58af51404689eb5b128/href">https://medium.com/media/6c6340b9748ac58af51404689eb5b128/href</a></iframe><p>After running this and trying to use our Action on a News article we get the expected alert:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/425/1*ASkTUq5FUsv8xJA6ioWs2w.png" /></figure><p>Testing on my phone and trying to use the extension on an image embedded in a tweet, gives the error message “Item is not a URL” which eminates from loadImage(). With this knowledge we know that the item passedthte test to see if it was an image type but did not provide a URL to load an image. What is going on? At this point I was forced to RTFM and discovered that NSItemProvider.loadItem() could provide a variety of things in its completion handler. The item could be one of the following: URL, Data, Filewrapper, or UIImage. Obviously, a URL was expected as the template names it “imageURL” but a URL might not be the item provided. With this new knowledge, we can handle for the other cases. It transpires that my embedded Twitter image was being provided as Data so once I’d handled this case it started to work.</p><p>Here’s a rewritten loadImage():</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/97e1036346950a87b2240c0241de69b6/href">https://medium.com/media/97e1036346950a87b2240c0241de69b6/href</a></iframe><p>And now everything works perfectly.</p><p>The moral of this story is that when looking at this code, I was suckered into thinking that all the forced unwrapping of optionals was just the barrier between the old Objective-C world, where the extension APIs come from, and the new Swift world. This led me to assume that the casting of <em>imageURL</em> to a URL was a formality rather than anything that could fail. Since it was called <em>imageURL,</em> I’d made the incorrect assumpotion that this was all it could be. In my particular case <em>imageURL</em> was actually of type Data.</p><p>The complete project can be found on <a href="https://github.com/matadan/ActionExtensionDemo">github</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=663100ef19d1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CoreData vs Realm (in Swift)]]></title>
            <link>https://medium.com/@andy_41059/coredata-vs-realm-in-swift-826a647ddeb7?source=rss-d4cef048fdd4------2</link>
            <guid isPermaLink="false">https://medium.com/p/826a647ddeb7</guid>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[realm]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[core-data]]></category>
            <dc:creator><![CDATA[Andrew Eades]]></dc:creator>
            <pubDate>Tue, 31 Oct 2017 14:47:35 GMT</pubDate>
            <atom:updated>2017-10-31T14:47:35.672Z</atom:updated>
            <content:encoded><![CDATA[<p>Having switched from CoreData to Realm, I thought it would be useful to note the key differences.</p><p>Firstly, I’m not using the cloud features of Realm and will probably use iCloud to sync data. I’m choosing free services and Realm is free to use if you don’t need to sync via their cloud platform.</p><p>Both CoreData and Realm use Objective-C based classes to instantiate real objects that are backed by some kind of store. CoreData uses an sqllite database by default so you will need some sqllite tools to view and edit the database by hand. Realm uses a proprietary format but they have a browser available for free on the Mac App Store to view and edit the database.</p><p>Out of the box Realm is much easier to get your head around than CoreData. CoreData manages objects explicitly in a ManagedObjectContext which you have to save to persist any changes whereas Realm persists all changes immediately within write blocks. To use CoreData you need a deep understanding of the API which is spread across a number of related classes. You can almost jump straight in with Realm. A major advantage I’ve found is that because Realm’s changes persist immediately, if your app crashes or you quit the simulator, you can inspect the database to see how it looks. Using CoreData, simply stopping the emulator without first saving the context, means you lose the database state at that point. This is almost enough on its own to make me stick with Realm. It may be less efficient and you could just save context on every change in CoreData but it feels like you are working against the API when you start doing things like this. It is worth remembering that Realm blocks when writing and access will cause a thread exception if not executed on the main thread.</p><p>Creating a schema differs too, using CoreData you build a model in XCode which generates the classes used to instatntiate the data into objects. Again, Realm is simpler in that you just have to inherit from Object and mark properties that you want to store as <em>@objc dynamic. </em>There are a number of functions you can override to help customise the way your objects persist etc. I like the visual repesentation of the model in XCode and it is arguably easier to work with one-to-many and many-to-many relationships with the XCode model editor than it is to use the LinkingObjects() functionality in Realm.</p><p>I think of a Realm class as a table definition and you can easily get a live result set by calling <em>realm.objects(MyObject.self) </em>which will continue to fire as rows are added, deleted or updated. You can add predicates to the results set so that you get pre-filtered and sorted results or you can map them to an array. In CoreData you can do similar things but again the API in Realm is simpler.</p><p>CoreData allows you to set how to deal with null references which is handy if you want deletions to cascade and not leave your database full of nils or references to objects that no longer exist. This is supposed to be coming in a new release but until then I have written a Cascading Deletion API for Realm which I will publish in due course.</p><p>In conclusion, having been through the hard graft of learning enough about CoreData to use it, I was reluctant to switch to anything else but the relative simplicity of Realm and the fact that it is just that bit more friendly when repeatedly launching and quitting the simulator means I’d recommend using Realm over CoreData.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=826a647ddeb7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Rude Truth About Homeopathy]]></title>
            <link>https://medium.com/@andy_41059/the-rude-truth-about-homeopathy-cfd06f2d56d1?source=rss-d4cef048fdd4------2</link>
            <guid isPermaLink="false">https://medium.com/p/cfd06f2d56d1</guid>
            <category><![CDATA[nhs]]></category>
            <category><![CDATA[health]]></category>
            <dc:creator><![CDATA[Andrew Eades]]></dc:creator>
            <pubDate>Sat, 07 Oct 2017 17:21:22 GMT</pubDate>
            <atom:updated>2017-10-07T17:36:17.615Z</atom:updated>
            <content:encoded><![CDATA[<p>Homeopathy is not a real medicine which is why the NHS is cutting it.</p><p>Homeopathy is at best an <strong>alternative</strong> medicine.</p><p>According to the <a href="http://www.nhs.uk/conditions/homeopathy/Pages/Introduction.aspx">NHS</a>: “Homeopathy is a ‘treatment’ based on the use of highly diluted substances, which practitioners claim can cause the body to heal itself.” The NHS does not consider homepathy to be a real medicine. That is why it is being cut.</p><p>No scientific evidence exists to demonstrate that homeopathy has better outcomes than a placebo. Anyone who charges you for a homeopathic therapy is peddling snake-oil. Except there is more substance to snake-oil. Maybe we should fund that as it claims similar universal benefits and uses the same kind of anecdotal evidence to support its claims.</p><p>Hope overrides reason. We can persuade ourselves that it probably does no harm and might do some good so what is the problem? That may be fine in private but it is not appropriate to ask the NHS to spend their overstretched budgets on homeopathy rather than on drugs that <strong>have</strong> passed the rigourous tests required to qualify them as medicine. Cancer drugs for children, for example, might be a better use of the money that is currently spent on homeopathic remedies.</p><p>The rude truth is that homeopathy does not work.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cfd06f2d56d1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Local File History for Xcode — My Solution]]></title>
            <link>https://medium.com/@andy_41059/local-file-history-for-xcode-my-solution-a869c0bb2188?source=rss-d4cef048fdd4------2</link>
            <guid isPermaLink="false">https://medium.com/p/a869c0bb2188</guid>
            <category><![CDATA[file-history]]></category>
            <category><![CDATA[recover]]></category>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[apple]]></category>
            <category><![CDATA[lost]]></category>
            <dc:creator><![CDATA[Andrew Eades]]></dc:creator>
            <pubDate>Mon, 02 Jan 2017 16:13:49 GMT</pubDate>
            <atom:updated>2018-09-07T17:02:40.080Z</atom:updated>
            <content:encoded><![CDATA[<p>“Aaargh. I just lost the changes in that file.”</p><p>Have you ever discarded <strong>ALL</strong> changes only to find that you really wanted <strong>SOME</strong> of the changes?</p><p>I have and having just spent a morning restoring a file to its former glory I’ve implemented a solution to help prevent losing my uncommitted changes again.</p><p>You will need Xcode and git installed and you should feel confident with the terminal.</p><p>For my example, I will assume that you have a development folder named “Development” in your user directory. i.e. ~/Development</p><h3>Step 1 — create a backup folder</h3><p>I’m using ~/DevelopmentBackup as my backup folder in the example.</p><p>Open a Terminal window and enter the following commands:</p><pre>&gt; mkdir ~/DevelopmentBackup</pre><h3>Step 2 — copy the files for the first time</h3><pre>&gt; rsync -r --exclude=.git ~/Development ~/DevelopmentBackup</pre><h3>Step 3 — initialise the backup</h3><pre>&gt; cd ~/DevelopmentBackup</pre><pre>&gt; git init</pre><pre>&gt; git add -A</pre><pre>&gt; git commit -m &quot;First backup&quot;</pre><h3>Step 4 — add a run script to your project build phase</h3><p>Now we have set up the git repository that we are going to use to store changes, we need to set up Xcode to keep the file changes tracked.</p><ol><li>Open your project in Xcode</li><li>Select the project in the Navigator pane</li><li>Select Build Phases</li><li>Add a new Run Script Phase by clicking the “+” button and selecting “New Run Script Phase”</li><li>Type the following into the script window:</li></ol><pre>NOW=$(date +&quot;%Y-%m-%d_%H%M&quot;)<br></pre><pre>PROJECTS_DIR=$HOME/Documents/Development/Projects</pre><pre>BACKUPS_DIR=$HOME/Documents/DevelopmentBackup/Projects<br></pre><pre>rsync -ru --exclude=.git $PROJECTS_DIR/ $BACKUPS_DIR<br></pre><pre>cd $BACKUPS_DIR</pre><pre>git add -A</pre><pre>git commit --allow-empty -m &quot;Backup: $NOW&quot;</pre><p>Now whenever you build the project, the backup script should run. It works by copying the entire development folder into the backup folder (stripping out the .git files used for your normal source control) and then committing all changes. The good news is that if you keep the Run Script as the final Build Phase, it will only backup successful builds. However, if you want to backup more often you can drag the Run Script up to an earlier phase.</p><p>I have multiple projects in my Development folder so this script backs them all up at the same time. If you have a huge number of projects going at once, you might want to optimise this so you only backup your currently active project.</p><p>You can view changes using “git log” or your preferred git viewer such as <a href="https://www.git-tower.com/mac/">Tower</a> or <a href="https://www.sourcetreeapp.com/">SourceTree</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a869c0bb2188" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mario Run is the Easiest Mario Ever]]></title>
            <link>https://medium.com/@andy_41059/mario-run-is-the-easiest-mario-ever-4bbdb9079211?source=rss-d4cef048fdd4------2</link>
            <guid isPermaLink="false">https://medium.com/p/4bbdb9079211</guid>
            <category><![CDATA[iphone]]></category>
            <category><![CDATA[nintendo]]></category>
            <category><![CDATA[apple]]></category>
            <category><![CDATA[gaming]]></category>
            <dc:creator><![CDATA[Andrew Eades]]></dc:creator>
            <pubDate>Sat, 17 Dec 2016 15:18:40 GMT</pubDate>
            <atom:updated>2016-12-18T12:40:41.919Z</atom:updated>
            <content:encoded><![CDATA[<p>I downloaded Mario Run late on Thursday evening and finished Tour mode on Saturday morning before Apple got around to sending me the notification that Mario Run was available!</p><p>Having enjoyed it immensely and played it for a good few hours I’m ready for more levels. I’ve never completed a Nintendo game this fast before. It took me 12 years to finally get to the end of Wind Waker so I’m not much of a completist either. I loved playing Mario Run. It felt great. The controls were beautifully balanced and all the Mario tropes helped me get a headstart on the mechanics. However…</p><p>I’ve blasted through the major content in a few hours. This is a deadly sin for a F2P game so it’ll be interesting to see how Nintendo keep me engaged from now on.</p><p>I should be their easiest customer as I grew up playing Nintendo games, love Mario and Zelda games, am an Apple fan and have been eagerly awaiting for this game ever since the annoucement. Oh — and the only console, I’ve ever queued for was the Wii U.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4bbdb9079211" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learn to Code Like a Hero]]></title>
            <link>https://medium.com/@andy_41059/learn-to-code-like-a-hero-ecf7804732e2?source=rss-d4cef048fdd4------2</link>
            <guid isPermaLink="false">https://medium.com/p/ecf7804732e2</guid>
            <dc:creator><![CDATA[Andrew Eades]]></dc:creator>
            <pubDate>Fri, 28 Oct 2016 13:44:42 GMT</pubDate>
            <atom:updated>2016-10-28T13:53:30.970Z</atom:updated>
            <content:encoded><![CDATA[<p>You need a desktop browser so if you are sitting at your desk, follow the <a href="http://hackertyper.net/">jump</a>…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ecf7804732e2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[App Store Thinning]]></title>
            <link>https://medium.com/@andy_41059/app-store-thinning-a16fef204b95?source=rss-d4cef048fdd4------2</link>
            <guid isPermaLink="false">https://medium.com/p/a16fef204b95</guid>
            <dc:creator><![CDATA[Andrew Eades]]></dc:creator>
            <pubDate>Sat, 03 Sep 2016 17:34:45 GMT</pubDate>
            <atom:updated>2016-09-03T21:38:11.422Z</atom:updated>
            <content:encoded><![CDATA[<p>With the App Store’s new submission guidelines, Apple have come down hard on so-called amateur apps.</p><blockquote>If your app looks like it was cobbled together in a few days, or you’re trying to get your first practice app into the store to impress your friends, please brace yourself for rejection. We have lots of serious developers who don’t want their quality apps to be surrounded by amateur hour.</blockquote><p>Apple are also reviewing older apps to see if they adhere to current guidelines which includes shorter non-spammy names. I think that all these changes will be good for most developers. However, I’ve seen some people complain that amateurs now won’t be able to release their app and show their friends and family. I don’t think this is true because you can still invite anybody you like to try your app as a beta. You just might not get to release it onto the store as easily.</p><p>For a developer that has experienced how hard it is to get visibility, I think this is almost certainly a good thing. I want my apps to succeed and to do that they need store presence. The amount of “choice” is not good for the consumer if half the apps are really crap-ware.</p><p>It’s often difficult to decide what is worth downloading these days and without some regular culling the problem will only get worse.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a16fef204b95" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>