Created
February 8, 2021 03:15
-
-
Save davidseek/9346bf32de1c7c4de0e2111d7dbabe69 to your computer and use it in GitHub Desktop.
dog.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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