From the course: iOS Development Tips

Unlock this course with a free trial

Join today to access over 22,700 courses taught by industry experts.

What is Hashable?

What is Hashable?

- [Instructor] You might have seen an error like this one about not conforming to Hashable. In this week's tip, let's look at what hashable is and why it's important. Now, just to get started here, I'm going to comment this out and let's go up to the top here. And let's do something very simple. Let's do let a equals 42. And I'm going to see if that equals anything. So I'll do a equals 42. And I can run those lines in my playground here and we can see that it's true. And this is just an integer. That works really well and if we're trying to figure out if something is equal, it's very easy to do so with an integer. But let's try something a little bit more complex and do the same thing with a string. Let aString equal forty-two and then I'm going to see how that works. And do aString equals Forty two. I can run that and of course, that comes out false. Now, here's the big difference, this is a single…

Contents