Chris Hannah Chris Hannah

Chris Hannah

Easily Clear Out Xcode Simulator

I’ve been getting annoyed recently with the amount of simulators I had installed in Xcode at work. But I’ve come across a really simple command that will fix this automatically.

I had 10.1, 10.2, 11.0. 11.1, and 11.2 installed, which I then reduced to just two of them. Then instead of painfully selecting and deleting each generated simulator, I just typed this:

fastlane snapshot reset_simulators

It uses Fastlane’s Snapshot tool, and what it does is delete all of your current simulators, and generate a set of new ones depening on the current SDKs you have installed.

Avatar Images

The avatar images “work”!

I have them displaying properly, downloading properly, and also using placeholders when it hasn’t been downloaded yet.

Images also cache up to a predefined limit, and are stored with the URL as a key.

The only thing left, is to then update whatever is presenting the placeholder image, when the real one has finished downloading.

Insights Into the Performance of My Blog

A few months ago, I started working on my own analytics service for my blog. I did this for many reasons, but ultimately for control and user privacy.

I only actually ever store four pieces of data:

  • Website Title
  • URL
  • Referral URL (Only if it’s been given)
  • Date Accessed

So while there’s not much data there, I can track everything I need, so like visits per day, per post, and I can get an idea of where traffic is coming from.

There have been occasions where the service, which I named “Minilytics”, has gone down though, so I can’t say I’ve tracked all the visits. But I’ve got a few things to share.

Performance

I made nice SQL query that shows me the performance of the site for each day. I use the view count for that day, and run it through a few conditions that will then output a string that I’ve manually set up. It’s not as exact as viewing the view count, but much easier to visualise.

Monthly View Count

Again, this isn’t totally accurate as these numbers may be higher and it hasn’t tracked them. But this simple count of views from each month, is a good way to check the general increase/decrease in visits over time.

I’m going to try writing some more queries soon, and see what other insights I can pull from the data. But overall I think the site has been getting a lot more traffic recently! Especially since I moved the blog over to WordPress a few days ago. My guess is that the WordPress installation has better meta tags, descriptions, and stuff that search engines like.

Apple Issue Statement About iPhone Power Management Feature

So, Apple finally came clean with the battery stuff on older iPhones:

We’ve been hearing feedback from our customers about the way we handle performance for iPhones with older batteries and how we have communicated that process. We know that some of you feel Apple has let you down. We apologize. There’s been a lot of misunderstanding about this issue, so we would like to clarify and let you know about some changes we’re making.

First and foremost, we have never — and would never — do anything to intentionally shorten the life of any Apple product, or degrade the user experience to drive customer upgrades. Our goal has always been to create products that our customers love, and making iPhones last as long as possible is an important part of that.

The situation isn’t ideal, in that they’ve annoyed, and probably confused some of their customers by not making it transparent from the start.

However, the actual power management feature that people are complaining about, actually seems like a really good idea.

About a year ago in iOS 10.2.1, we delivered a software update that improves power management during peak workloads to avoid unexpected shutdowns on iPhone 6, iPhone 6 Plus, iPhone 6s, iPhone 6s Plus, and iPhone SE. With the update, iOS dynamically manages the maximum performance of some system components when needed to prevent a shutdown. While these changes may go unnoticed, in some cases users may experience longer launch times for apps and other reductions in performance.

I’ve seen a lot of news outlets saying that this is Apple trying to move people to newer iPhones, and even that it is causing iPhones to not last as long (Not the battery, but the actual device’s lifespan).

I can only see this update doing the exact opposite. It slowed down performance, but that is to extend the short term battery life, and also the long term life of the device.

The lack of communication is what messes everything up though. Even if you disregard the trust factor of Apple doing this without telling anybody, it leads users to believe that they are affected by it, when in some cases they might not be. So after seeing a small bit of news about Apple slowing down iPhones, someone with a completely unrelated device, or even an affected device with another issue, would more than likely blame this new power management update.

What Apple are doing about this, is actually quite impressive. They’re reducing the price of an out of warranty battery replacement by $50. But more importantly, they’re going to start making the battery heath more visible in iOS. It’s something you have on a Mac, and I will welcome it to iOS.

They could have avoided this whole situation though, as clearly they proved they can be transparent about this feature (although in this case it was forced). So why didn’t they write a small article about a “new power management feature” and how they’re extending the lifespans of older devices, and then just make the whole thing optional.

SpaceX Falcon 9 Rocket Launch Timelapse

Jesse Watson has just published a time-lapse he shot of the recent SpaceX launch. You know, the one that looked really strange, and not like any rocket we’ve seen before. However the video is of course over a much longer period of time, and shows a wider angle of everything that went on.

He filmed it from Yuma Arizona, roughly 400 miles away from the launch site. And it took quite a bit of planning:

I scouted four locations that had foregrounds to add depth to the imagery and was uniquely inspiring to my hometown. Location choices were between a favorite local hiking mountain, the Imperial Sand Dunes, or a small hill that resides in the historic downtown area overlooking the city. I ended up choosing the location that overlooked the city, partially because it was the easiest to access with all of my time-lapse gear. I used The Photographer’s Ephemeris and Google Maps to help scouting and initial line up.

I have never shot a rocket launch before, so I did not know exactly what to expect as far as exposure or precise location of the rocket in the horizon. I wanted to be prepared to capture comprehensive coverage of the spectacle. Therefore I packed four cameras and five lenses, to cover wide to telephoto details of the scene. Three of the cameras were rolling time-lapse and 1 was setup for telephoto video.

It’s certainly an interesting story, and also a fantastic video.

Watch below in the embedded player, or if that fails, it’s on Vimeo along with his story.

SpaceX Falcon 9 Rocket Launch from Jesse Watson on Vimeo.

2017 - Year in Review

It’s time for my year in review article!

I started this last year, and I’m sure I’ve done some before that, but this is probably the most packed!

🙋🏻‍♂️ Personal Moments

This year has been quite a significant one for me personally, in that I’ve reached a few major milestones.

You could say now being 25 is a milestone, but I can’t say I put any effort into that, so it’s not exactly what I was thinking of. I would probably say the three main ones would be finishing university, getting my first job in development, and also my general attitude towards development, because I feel like I’ve been doing a lot of creating this year.

To expand on the first two a bit more, the course I completed was Computer Science, and it sure was a relief to finally finish that. I’m sure other people may have found it useful, but I think I went in with slightly too much experience, where I found it rather boring. Especially as I was writing Swift by then, and the course was mainly in Java. However, I did it, and I won’t have to do it again.

My new job is an iOS Developer at an international money transfer company, based in London, called World First. I don’t want to get into too much detail on it, but it’s certainly a big change from what I used to do as a job. Because although I’ve been programming and making apps for quite some time, my actual day to day job was an engineer, repairing and configuring physical electrical equipment. It sure is a big step, and it’s even better than I thought it would be.

👨🏻‍💻 Projects

So now for what I’ve been making myself. It’s been a mixed year, but basically I’ve made some iOS and Mac apps, along with a couple extra things.

  • H News – A very basic hacker news client app for iPhone, which was fun to make, but there’s no way it’s going to be released on the App Store.
  • TodoApp – It’s in the name, but this is a simple “task manager” app I developed for a job interview, which I then had to turn down 😎.
  • Pretty Regular Expressions – This is two apps – macOS and iOS. It’s a regular expression editor, and checker, although I’m not sure if I even know how to describe it.
  • cwiki – Basically the search and reading functionality of Qwiki, but put into the command line.
  • slink – Another one of my now long retired apps, Tiny Me which was a goo.gl url shortener, turned into command line form.
  • hacker – 💤 You know the story, the command line version of the H News app.
  • TitleCase – I promise this is the lat one. This is another command line app, but this time it was from scratch. It makes use of Brett Terpstra’s TitleCase API, and makes it accessible from the…
  • Keep Track – This is an iOS app I made as my project in my final year of computer science, and it’s a basic organiser of things. I was learning Realm database, and also some things like searching, filtering, and other parts of iOS development.
  • Hydrate (In Progress) – One of my “current” projects, this is a water intake tracking app for iOS. I already know that there are good alternatives, but it’s more of a personal project, that will be released when it’s done.
  • SOLID – A very simple wallpaper generator app for iOS. It was made because of my desire to easily create a solid wallpaper background. I later added themes, standard colours, and saving!
  • TextCase API – Something quite random, but I expanded upon the TitleCase functionality, and built my own custom title case formatter, along with the Mocking Spongebob case.

🛫 Travelling

I’ve been doing a lot of travelling recently, and I hadn’t realised how much of it was in 2017 until I looked back through all my photos.

Turns out, I did travel quite a lot within England, and a few extra countries too!

Here are the places I’ve visited this year (Stayed for at least one night):

  • Bournemouth, England.
  • Reading, England.
  • Eastbourne, England.
  • Barcelona, Spain.
  • Albufeira, Portugal.
  • Dublin, Ireland.
  • Killarney, Ireland.
  • Wells-next-the-sea, England.
  • Tenerife, Canary Islands.
  • Lanzarote, Canary Islands.

And of course, countless days and nights in London.

So if you count the Canary Islands as being separate to Spain (as they pretty much are), I’ve travelled to 5 different places this year!

However, I could do better!

📝 Writing

As always, I’ve been writing for this blog all year. But here are a few of my favourite pieces:

🙌🏻 What I’ve Enjoyed

I’m a constant consumer of most things, so I just thought I’d pick out a few recommendations.

  • 🎵 Catfish and the Bottlemen – The Ride Album (Technically came out in 2016, but I heard it in 2017).
  • 📖 The Martian by Andy Weir.
  • 📖 Astrophysics for People in a Hurry by Neil deGrasse Tyson (Currently reading, but super interesting!).
  • 🎤 Star Talk Podcast with Neil deGrasse Tyson and Chuck Nice.
  • 🎤 The Instance (World of Warcraft podcast for true nerds 🤓).
  • 📺 Game of Thrones
  • 📺 Planet Earth II
  • 📺 Blue Planet II
  • 🎥 Thor: Ragnarok (2017)
  • 🎥 Spider-Man Homecoming (2017)
  • 🎥 Everest (2015)
  • 🎥 Blackfish (2013)

💻 Tech

Now for my current tech that I own and use/don’t use. It is admittedly, rather simple.

My main device is my MacBook, I’m not a 100% iOS guy, and I probably never will be. My 2016 MacBook Pro with Touch Bar is my favourite device. I even love the keyboard. And the Touch Bar too!

After that, I would have to say the next important is my iPad Air 2, and my iPhone 7 Plus, neither of them I plan to upgrade with any urgency. I’m really happy with my iPhone, and my iPad can only be bettered by getting an Apple Pencil, which of course would require a new iPad. So not a priority.

To tie these devices together, I own a Series 3 Apple Watch, and a pair of AirPods. Both of these I couldn’t live without, and I never leave the house without either of them.

Apart from these devices, everything else is used sporadically.

I have a Kindle that I use for reading when travelling, a PS4 I use when I want to play Fifa, an Apple TV I use for a few days when a new update comes out, and an Amazon Echo that hasn’t even been switched on for months.

So really, my current tech usage is completely Apple – Laptop, Tablet, Phone, Watch, and Earphones.

📇 Web Presence

I’ve had a few little website related projects this year, including a couple revisions of a weekly newsletter, that sadly failed.

But the majority of 2017 was spent moving my overall presence towards my chrishannah.me domain.

There is the main website which contains basic information about me, what I’m up to, and a showcase of all my projects. I then have the blog and micro subdomains, for my full blog and relatively new Micro blog(If you want an invite, just let me know).

I have a few mini websites for small projects, and released apps, but they’re mainly single pages.

However, like other parts of my life, my online presence has become rather simplified.

👀 Expectations From Last Year

My only aim from last year was to make more stuff, and I can certainly say I fulfilled that!

Maybe I should be more descriptive with my goals.

📜 Plans for 2018

So here goes a much better and thought out plan for 2018:

Website

I’m going to aim for a big reshuffle of my website again next year, which will include some consolidation of content, and a redesign.

In particular, I want to combine my homepage, blog, and micro blog, into at least 2 separate websites. So, either merge my homepage and my main blog, or have a separate homepage, and keep all my blog content in the one place. This decision will take some thought, and may even include other content from elsewhere.

On top of this reorganisation, I do plan on having a good look at switching my blog from the Ghost platform, to something like WordPress, that has better support for third-party apps, but also the simplicity and speed benefits you get from using Ghost.

This also means, that I may as well start a redesign. Because I’d have to convert my blog theme anyway, so I may as well improve it while I’m doing that.

This will most likely be started this year, but it will take a while.

Something Extra

Since tinkering with the idea of a newsletter, I want to find that extra thing I can add to the website. Just so I can have a regular piece of content, to maybe attract regular readers.

Projects

After doing a big number of random projects this year, I want to focus down with Swift next year. So the most important thing will be the quality of code, and getting better at that, and also making more complex projects and applications.

Travelling

I’m still a big fan of travelling, and I want to do loads next year. But I think the way to do this is by going for a lot of small trips, to loads of different locations.

I already have a head start on this, as I’m going to Berlin in January, and Copenhagen in February.

 Extras

It’s the time of year right now, where you should ideally decide on a New Years resolution. But it’s also a good idea to work out if there are any streaks you want to try to achieve. For example a “365 Photo” challenge, where you take a photo every day for a year.

So I think I would like to try to at least write something once a day, and I’d like to attempt the photo streak.

Turns Out, Apple Are Slowing Down Phones!

Matthew Panzarino writing for TechCrunch:

Because of a Reddit post and the loose interpretation of subsequent benchmark tests posted by Primate Labs’ John Poole, the “Apple throttles old iPhones” meme has reared its ugly head again.

The gist, as it always is, is that Apple is being super petty and trying to force customers to upgrade their phones by making their old phones run slower.

As always, the answer is no. It would be beyond stupid and incredibly short-sighted for Apple to do this and, if it was actually true, would likely lead to tangles of a governmental and legal nature that no company like Apple would ever want to happen.

Instead, Apple is focusing attention on smoothing out the very high and quick peaks of power draw that can cause problems with older batteries.

Here is the statement Apple gave them:

Our goal is to deliver the best experience for customers, which includes overall performance and prolonging the life of their devices. Lithium-ion batteries become less capable of supplying peak current demands when in cold conditions, have a low battery charge or as they age over time, which can result in the device unexpectedly shutting down to protect its electronic components.

Last year we released a feature for iPhone 6, iPhone 6s and iPhone SE to smooth out the instantaneous peaks only when needed to prevent the device from unexpectedly shutting down during these conditions. We’ve now extended that feature to iPhone 7 with iOS 11.2, and plan to add support for other products in the future.

I understand the transparency was probably the biggest issue here, especially as knowing hardware manufacturer will eventually slow down your devices without you knowing isn’t a good thing.

However, what Apple actually did, with slowing down performance in certain peaks to ensure the battery lasted longer, and in some cases didn’t unexpectedly turn off, is a good thing.

One solution would be to alert the users that had a bad performing battery, and then offered them to switch on a power management feature, and maybe even have a link to the iPhone section of the Apple Store!

Pokémon GO Will Soon Use ARKit!

Pokémon GO Screenshots

Coming straight from the Pokémon GO blog:

Trainers, Get ready for even more realistic Pokémon encounters: AR+ is coming to Pokémon GO! AR+ leverages Apple’s ARKit framework to build on the AR work already implemented in Pokémon GO. Soon, Trainers around the world running iOS 11 on iPhone 6s and newer models can experience AR+ in Pokémon GO.

I think nearly everyone has seen the incredible ARKit in action, and it’s going to add a lot of benefits to Pokémon GO:

  • Everything is based upon fixed locations, so the Pokémon should stick to their position and not move around everywhere.
  • The scale will be much more accurate, so a Pikachu will not be the same size as Gyarados.
  • Pokémon will now have a sense of awareness, meaning you may need to sneak around, otherwise you could scare it away. That’s certainly one great addition that is enabled by ARKit.
  • Because of the real world positioning, it will enable them to place Pokémon in more suitable locations, such as a Snorlax blocking your path!

I can’t wait to start playing it again!

Read the full announcement.
Download Pokémon GO for iOS.

Better String in Swift Using Stryng

If you write in Swift, then there’s a good chance you’ve tried to access a section (Substring) of a String.

Usually it’s done by using an index, and an offset. But in some cases you need to specify the start index along with an offset, and also an end index with an offset.

It gets a bit messy.

Luckily I’ve just discovered Stryng on GitHub, and it’s a beautiful solution.

There’s a ton of examples, and you should totally read the README even if you aren’t going to use it. But here’s my favourite:

Before Stryng:

let message = “One Two Three”
message[message.index(message.startIndex, offsetBy: 4)..<message.index(message.startIndex, offsetBy: 7)] // “Two”

After Stryng:

let message = “One Two Three”
message[4..<7] // "Two”

🤩