LookinWeakContainer.m 801 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifdef SHOULD_COMPILE_LOOKIN_SERVER
  2. //
  3. // LookinWeakContainer.m
  4. // Lookin
  5. //
  6. // Created by Li Kai on 2019/8/14.
  7. // https://lookin.work
  8. //
  9. #import "LookinWeakContainer.h"
  10. @implementation LookinWeakContainer
  11. + (instancetype)containerWithObject:(id)object {
  12. LookinWeakContainer *container = [LookinWeakContainer new];
  13. container.object = object;
  14. return container;
  15. }
  16. - (NSUInteger)hash {
  17. return [self.object hash];
  18. }
  19. - (BOOL)isEqual:(id)object {
  20. if (self == object) {
  21. return YES;
  22. }
  23. if (![object isKindOfClass:[LookinWeakContainer class]]) {
  24. return NO;
  25. }
  26. LookinWeakContainer *comparedObj = object;
  27. if ([self.object isEqual:comparedObj.object]) {
  28. return YES;
  29. }
  30. return NO;
  31. }
  32. @end
  33. #endif /* SHOULD_COMPILE_LOOKIN_SERVER */