Last active
May 3, 2018 18:57
-
-
Save epv44/81c5ca90f88b2bb9d1c08979f09b5eab to your computer and use it in GitHub Desktop.
stitch fix phone question
This file contains hidden or 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
| //This is model setup, the important stuff is at the bottom. | |
| enum ClothingColor { | |
| case red, green, blue, purple, silver | |
| } | |
| enum ClothingPattern { | |
| case solid, polkadots, checks, herringbone | |
| } | |
| enum ClothingType { | |
| case pants, dress, skirt, shoes, bracelet | |
| } | |
| enum ClothingFit { | |
| case slim, normal, loose | |
| } | |
| struct ClothingItem { | |
| let id: String | |
| let color: ClothingColor | |
| let secondaryColor: ClothingColor | |
| let pattern: ClothingPattern | |
| let type: ClothingType | |
| let fit: ClothingFit | |
| } | |
| //Sample service class we provide. | |
| protocol DataService_Protocol { | |
| func data(completion: @escaping ([ClothingItem]) -> Void) | |
| } | |
| class ClothingDataService: DataService_Protocol { | |
| func data(completion: @escaping ([ClothingItem]) -> Void) { | |
| let clothingItems = [ClothingItem(id: "123", color: .red, secondaryColor: .blue, pattern: .checks, type: .pants, fit: .normal), | |
| ClothingItem(id: "543", color: .blue, secondaryColor: .silver, pattern: .checks, type: .pants, fit: .normal)] | |
| completion(clothingItems) | |
| } | |
| } | |
| /** | |
| We'd like you to take a list of items, filter out all items for "total" | |
| avoids, and for items with "partial" avoids, sort those to the end of the list and display in the provided table view. | |
| At minimum candidate talk about using a view controller, a table view, and actually write some type of filtering logic. | |
| Follow ups: | |
| 1. Error handling (talk about different ways to do it and implement one) -> Result<T>, (onSuccess:, @escaping T onError: @escaping Error), Promises... | |
| 2. Multithreading with GCD (the data source executes off the main thread but keep UI manipulation on the main thread). | |
| 3. Testing, modify for dependency injection -> Shows they understand protocols. | |
| **/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment