Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //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 should use a view controller, a table view, and 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.
- **/
Add Comment
Please, Sign In to add comment