Guest User

Untitled

a guest
Sep 19th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. //MARK: Create Specifications
  2. protocol Specification {
  3. associatedtype T
  4.  
  5. func isSatisfied(item: T) -> Bool
  6. }
  7.  
  8. struct ColorSpecification: Specification {
  9. typealias T = Product
  10.  
  11. var color: Color
  12.  
  13. func isSatisfied(item: Product) -> Bool {
  14. return item.color == color
  15. }
  16. }
  17.  
  18. struct SizeSpecification: Specification {
  19. typealias T = Product
  20.  
  21. var size: Size
  22.  
  23. func isSatisfied(item: Product) -> Bool {
  24. return item.size == size
  25. }
  26. }
Add Comment
Please, Sign In to add comment