24th June 2017

Snapchat has just released a new feature, and it’s one that can be taken in a few different ways. It’s Snap Map, and basically it’s a way to share and view peoples locations.

To activate Snap Map, just pinch to zoom out, and you can view any of your friends that are currently sharing their location with you.

In their short video showing the new feature (Now unavailable), it seems as it’s being advertised as a way to see where your friends are, so you can go hang out with them.

But at the same time, it’s very easy to accidentally share your location with more people than you want. This becomes a much bigger problem with a service such as Snapchat, as the majority of users are very young.

Fortunately, there is a setting in Snapchat where you can limit who can view your location. I would suggest turning this feature off completely, but it’s not a problem if it’s managed properly.

So here is how to fine-tune your privacy preferences in Snapchat:

1st Method – From Settings

  1. When viewing your profile in Snapchat, press the settings icon in the top-right hand corner.
  2. Scroll down to the section labelled “WHO CAN…”.
  3. Tap on “See My Location”.
  4. You can then choose any location sharing options from here.

2nd Method – From Snap Map

  1. When viewing the map using Snap Map, press the settings icon in the top-right hand corner.
  2. You get moved straight to the location settings, where you can choose any sharing options.

Location Sharing Options

When sharing your location in Snapchat, there are three different options to choose from (of course there’s also the option to not share it at all, by never enabling the feature).

  • Ghost Mode (Location is hidden)
  • My Friends
  • Select Friends…

So you can either hide it completely, share your location with all of your friends, or just to a selected group. In some cases, “My Friends” is a completely fine option, but that only makes sense if you only add close friends. But if you like to add other people you don’t know very well, or you just want to completely sure who you’re sharing your location with, the latter “Select Friends” option is much better suited.

Extra Tips

  • When using “My Friends”, any friends added will automatically be allowed to view your profile.
  • When using “Select Friends…”, people you allow to see your location won’t be notified, they will simply be able to see you on their map.
  • Your location is only received while you are using the Snapchat app, and apparently not in the background.
  • Any location data is deleted after a few hours.
  • To clear your last locations, toggle Ghost Mode on and off. This will clear your past data, but keep your sharing settings the same.
  • The last tip – Just be careful who you’re giving your location to.

10th March 2017

This article is part of a collection of articles about Swift Basics, where I try to explain different parts of Swift development in a more understandable way.


In most iOS applications, you will probably need to use a UITableView at some point. In this short guide, you will find out how to create a UITableView, and populate it with your own data.

UITableView

As Apple say in the documentation, “A table view displays a list of items in a single column.”.

Basically, it’s a list of cells, that you can take complete control over.

With a UITableView object, there are two ways in which you can control them. They are the UITableViewDelegate, and the UITableViewDataSource. The delegate is what manages the interactions on the table cells, such as selecting and reordering. The UITableViewDataSource is as you may of guessed, what controls the data that populates the table, and also configures the cells in the Table View.

Continue Reading

08th March 2017

This article is part of a collection of articles about Swift Basics, where I try to explain different parts of Swift development in a more understandable way.


While doing some development in Swift, using Dates and DateFormatters, I found the task of going through every format option quite boring. So this is a quick “cheatsheet”, that anyone can use to identify what style of Date/Time they want to display, and also the code to get it.

Of course, you first need to create a Date object, which used in this way will generate the current date/time. Then you will also need a DateFormatter object, which handles the formatting, and is used to output the result into a usable String.

let date = Date()
let dateFormatter = DateFormatter()

Date

Full Date

Output: Wednesday, March 8, 2017

Code:

let date = Date()
let dateFormatter = DateFormatter()
dateFormatter.dateStyle = .full
let stringOutput = dateFormatter.string(from: date)

Long Date

Output: March 8, 2017

Code:

let date = Date()
let dateFormatter = DateFormatter()
dateFormatter.dateStyle = .long
let stringOutput = dateFormatter.string(from: date)

Medium Date

Output: Mar 8, 2017

Code:

let date = Date()
let dateFormatter = DateFormatter()
dateFormatter.dateStyle = .medium
let stringOutput = dateFormatter.string(from: date)

Short Date

Output: 3/8/17

Code:

let date = Date()
let dateFormatter = DateFormatter()
dateFormatter.dateStyle = .short
let stringOutput = dateFormatter.string(from: date)

Time

Full Time

Output: 1:26:32 PM Greenwich Mean Time

Code:

let date = Date()
let dateFormatter = DateFormatter()
dateFormatter.timeStyle = .full
let stringOutput = dateFormatter.string(from: date)

Long Time

Output: 1:26:32 PM GMT

Code:

let date = Date()
let dateFormatter = DateFormatter()
dateFormatter.timeStyle = .long
let stringOutput = dateFormatter.string(from: date)

Medium Time

Output: 1:26:32 PM

Code:

let date = Date()
let dateFormatter = DateFormatter()
dateFormatter.timeStyle = .medium
let stringOutput = dateFormatter.string(from: date)

Short Time

Output: 1:26 PM

Code:

let date = Date()
let dateFormatter = DateFormatter()
dateFormatter.timeStyle = .short
let stringOutput = dateFormatter.string(from: date)

Date and Time

You can of course, use the dateFormat and timeFormat together to output the date and time in the same string.

Here is an example:

Output: March 8, 2017 at 1:37 PM

Code:

let date = Date()
let dateFormatter = DateFormatter()
dateFormatter.dateStyle = .long
dateFormatter.timeStyle = .short
let stringOutput = dateFormatter.string(from: date)

Download

I’ve made a Swift Playground containing all of the formats for date and time, which you can use yourself by copying the code from GitHub.

01st March 2017

Developers are always talking about whether to use Git from the command line, or via a GUI such as GitHub Desktop. Well, if you’re using Xcode, then there’s a much simpler method that’s already built-in! It’s called Xcode Source Control[1].

I’m just about to upload one of my projects to GitHub, so I thought I’d share the process. Especially as I’ve recently found it so much easier to use, because it’s right there in Xcode!

Step 1

The first step is to let Xcode create a Git repository on your Mac. It should be checked by default.

Step 2

Then you will need to create a new repository on GitHub. Give it a name, description, and make it Public/Private. But make sure you don’t select “Initialize this repository with a README”.


Then select “Create Repository”.

Step 3

Then you’ll be redirected to a page where you’ll be asked to set up your repository. You only need one thing from this page, and it’s the URL in the Quick Setup section.

In my case, this is https://github.com/chrishannah/CH-Work-Item.git.

Step 4

Now it’s time to add this into Xcode.

Simply select Source Control from the menu bar, your project name, and then select the “Configure project” option.

Once you’ve done that, the next step is to select the “Remotes” tab, then select the + button in the bottom-left corner, and select “Add Remote”.

Here you will need to give it a name, and an address. The address is the URL previously found on the GitHub set up page. Then press “Add Remote”.

Step 5

The repository has now been created on GitHub, and added to Xcode, the next step is to initialise the repository.

Again, from the menu bar, select Source Control, and then Commit.

A window will appear with all the changes to the repository, since this hasn’t been initialised yet, it will show all of your projects files.

Simply add a commit message, select “Push to remote”, which should automatically select your GitHub repository, and press “Commit X Files and Push”.


If you haven’t connected your GitHub to Xcode before, you will be prompted for a username and password, these are your GitHub details.

That’s It!

Once you’ve completed all of the previous steps, your project should now be on GitHub, and if you go back to the repository on GitHub, it should now be populated.

If you haven’t already (like me above), it’s probably best to add a README file.

Managing Your Repository

From here it’s really easy to manage your repository in Xcode. It’s all found in the Source Control menu.

From there you can commit new files, push them to GitHub, pull any new changes, and anything else you’d expect from a Git client.


I hope that this guide proved useful, and provided a bit of piece of mind for you knowing that your project is now essentially backed up.

If you want to see the other tutorials I have here, then there is a Guide section.

You can find me on GitHub as chrishannah.


  1. For more information, there is a session from WWDC 2013, “Understanding Source Control in Xcode” that explains this in more detail ↩︎

02nd February 2017

If you’re an Apple Music subscriber, or you just have a super large iTunes library, then downloading all of your music to a device can be a giant pain.

With the iPhone storage sizes getting bigger, having your entire collection downloaded is even more of a possibility. I for example have a 128GB iPhone 7 Plus, so I easily have enough space for my entire library.

The only problem is that on iOS, there isn’t a “download all” button. However there’s a really simple solution if you have a Mac available.

Step 1 – In the sidebar, right click and choose Create Smart Playlist.

Step 2 – Change the rules to “Artist is not (blank)” like the image below.

Step 3 – Open the Playlist in the Music app on your iOS device.

Step 4 – Tap on the “…” button in the top right, and press Download.

That’s it!

All of your music library should then start to download.

Another bonus that this gives you, is that because it’s a Smart Playlist, it will continue to update as you add music to your library. As the rule simply is that it matches any item where the Artist name isn’t blank, which should be all of them!

14th January 2017

I’ve seen a few people have issues regarding opening applications that they have downloaded from the internet, that they get the error below, about it being from an unidentified developer.

This is due to the latest security settings in macOS, and these are accessible in the Security & Privacy pane in System Preferences.

There are two options to choose from:

  • App Store
  • App Store and identified developers

Of course the top option means you can only open applications distributed from the Mac App Store. But the other one means it allows all apps from the Mac App Store, and also any developers that have signed their application with Apple’s “Developer ID” certificate. This allows developers to distribute their apps outside of the store, but also maintain the same security features, and trust level as the former option.

You can read more about Developer ID on the Apple Developer website.

There is also a temporary solution, which lets you override the security settings on a case by case basis. Just press “Open Anyway” at the bottom of the preferences pane, and it will then open like normal!

Edit (14th January 2017):

My friend Cesare let me know that you can also unlock a third option, this let’s you choose “Anywhere” in the preferences, and will let you download and open any application without restriction.

To unlock it, just open Terminal (Applications/Utilities/Terminal) and enter the following line exactly:

sudo spctl --master-disable

If you want to return it back to normal, just enter the following:

sudo spctl --master-enable

28th November 2016

With the MacBook Pro’s new Touch Bar, you can now create your own favicon that will appear there when a user sets it as a bookmark. The same file is also use to create an alpha mask when adding your website as a Pinned Tab.

It’s a small bit of code, that you add to your <HEAD> section, just by your other favicons.

Just specify that it is a “mask-icon”, add the location for the file (has to be SVG), and then specify a colour to be used. The colour is the background on the Touch Bar icon, and it’s also the colour used in the Pinned Tab mask.

Code:

<link 
    rel="mask-icon" 
    href="safari-pinned-tab.svg" 
    color="#dc7604"
>

As an example, you can see the new touch bar icon I made for Radical Thinker.

If you haven’t already, you can also set an icon for when a user adds your website to their home screen on iOS. This is done similarly, but doesn’t have to be an SVG.

Code:

<link 
    rel="apple-touch-icon" 
    sizes="180x180" 
    href="apple-touch-icon.png"
>