What I Learned This Week 15/9/16

What I Learned This Week is a weekly blog of small dollops of info I remember from the previous 7 days. It covers a wide range of topics, often tech, but sometimes wrestling, beer and a random selection of other things too. Have anything to add, find me on Twitter

Swift variables are as many things as you want them to be

This week has been learning Swift. I have been using parts of Swift here and there, but I’ve started a new project, and it seems wrong to begin a new iOS project in anything other than Swift at this point, so this is the first time I’ve used Swift from the ground up. So this is not completely new, but a reintroduction to a couple of really lovely features in Swift variables.
Firstly The Tuple, to fans of really hard sums, the concept of a tuple won’t be new, but in Swift a Tuple is a variable that is actually a collection of associated variables, of differing types. They’re kind of like a dictionary, but because they behave like a variable, they’re a lot simpler to use. This means you can write a function that returns just one argument, but from that you can get a load of data - response code, response description, raw data, etc - all from the same variable.
The second cool thing is that Swift is Unicode, that means you can label your variables with 🤔or 💩or 🦀. Not too certain how readable that would actually be, but it makes coding a little more fun!
More details on the Swift basics

Films are better when they’re actually filmed

Maybe I sound like an old man, but remember when films weren’t all computer generated? The things on the screen were actually happening, and actors were acting with the environment rather than a green screen. I’m not longing for a time that never existed before special effects and trickery. But CG has really gone too far, and films are suffering as a result. Mad Max Fury Road(£) was one of the best looking special effects for many years, and a huge part of that is because loads of the stuff actually happened, and then CG was used to add finishing touches. Here’s a collection of rushes from the film with no CG, even without that added, it still looks incredible.

Maybe I should become veggie

I was brought up vegetarian, I stopped as a young adult when I realised meat just tasted too great to miss out on. A couple of stories this week have made me reconsider this choice for really hippy reasons.
Dolphins, as all know are incredibly intelligent, but its been reported this week that we now know Dolphins converse with each other in a structure we might recognise as sentences. This opens the door to translation, and maybe more. Although that is way in the future, its a really intriguing discovery.
The Guardian this week also reported on consciousness in animals. The science community has for a while had a Victorian-like approach to animals, that assumes Humans are somehow inherently superior, and different from other animals. This view is slowly changing the more we discover, and so does the perceived glass ceiling we have between ourselves and other animals.

The Cloud is a background mode

My current project does a lot of background work on the iPhone. Backgrounding is really restrictive on iOS, for good reason. Do backgrounding wrong, and you can use loads of power, crash other apps, and eat data. And as the user can’t see you doing it, they assume its the phone, or someone else’s app, making your app a very bad citizen.
I recently checked out Marco Arment’s Overcast podcast app. Its a great app if you’re a podcast listener, probably the most popular for those who’ve realised Apple’s attempt at mobile podcasts is unusably bad. Unfortunately Overcast doesn’t work for me, but the reason it doesn’t work is because of the inventive way Overcast uses the cloud.
Most podcast clients will refresh in the background periodically, downloading new episodes when found. This has a couple of issues; The app can’t choose when to refresh - thats up to the phone, the app can request certain times or locations, but wether that actually happens, that depends on your iPhone’s current mood. The second issue is that this uses a reasonable amount of power, for a result the user doesn’t see, so if performance or battery life drops, the current foreground app gets the blame.
Overcast farms this process out to the cloud. You register the podcast with the app, which then registers for remote notifications from the Overcast servers. The Overcast servers then check for new podcasts for every user, and sends a notification to the apps registered for that podcast that they should begin downloading.
This has some great benefits, not only does it use less power, but its more responsive - the new episodes appear almost instantly, rather than waiting for whenever your phone next decides to check.
I’m not convinced this kind of pattern would work with my current project, but I’m certainly keeping this in mind.

WD40 removes sealant

Probably the only useful thing I’ve added to this blog. I had the call on Sunday to remove some sealant from around my bath, but had no sealant remover. Tuns out WD40 works just as well!