You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
987 B

2 years ago
  1. //
  2. // SwinjectStoryboardOption.swift
  3. // Swinject
  4. //
  5. // Created by Yoichi Tagaya on 2/28/16.
  6. // Copyright © 2016 Swinject Contributors. All rights reserved.
  7. //
  8. import Swinject
  9. #if os(iOS) || os(OSX) || os(tvOS)
  10. internal struct SwinjectStoryboardOption: ServiceKeyOption {
  11. internal let controllerType: String
  12. internal init(controllerType: Container.Controller.Type) {
  13. self.controllerType = String(reflecting: controllerType)
  14. }
  15. internal func isEqualTo(_ another: ServiceKeyOption) -> Bool {
  16. guard let another = another as? SwinjectStoryboardOption else {
  17. return false
  18. }
  19. return self.controllerType == another.controllerType
  20. }
  21. internal var hashValue: Int {
  22. return controllerType.hashValue
  23. }
  24. internal var description: String {
  25. return "Storyboard: \(controllerType)"
  26. }
  27. func hash(into: inout Hasher) {
  28. into.combine(controllerType)
  29. }
  30. }
  31. #endif