Skip to content

Instantly share code, notes, and snippets.

@davidseek
Created February 8, 2021 03:15
Show Gist options
  • Save davidseek/9346bf32de1c7c4de0e2111d7dbabe69 to your computer and use it in GitHub Desktop.
Save davidseek/9346bf32de1c7c4de0e2111d7dbabe69 to your computer and use it in GitHub Desktop.
dog.swift
// Since we're iOS engineers,
// we might want to use a
// light weight type like a struct
struct Dog {
// A dog object needs an id for identification
let uid: String
// And important for out hotel, we need to know the size.
// We could use an integer, but that's not very easy to read.
// A String is a bad idea because mistakes can easily occur.
// That's why we want to use a dedicated enum.
// Tell your interviewer, that type-safety is important to you.
// Really hard to disagree.
let size: DogSize
}
enum DogSize {
case small, medium, large
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment