FLEXRuntime+Compare.m 1013 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //
  2. // FLEXRuntime+Compare.m
  3. // FLEX
  4. //
  5. // Created by Tanner Bennett on 8/28/19.
  6. // Copyright © 2020 FLEX Team. All rights reserved.
  7. //
  8. #import "FLEXRuntime+Compare.h"
  9. @implementation FLEXProperty (Compare)
  10. - (NSComparisonResult)compare:(FLEXProperty *)other {
  11. NSComparisonResult r = [self.name caseInsensitiveCompare:other.name];
  12. if (r == NSOrderedSame) {
  13. // TODO make sure empty image name sorts above an image name
  14. return [self.imageName ?: @"" compare:other.imageName];
  15. }
  16. return r;
  17. }
  18. @end
  19. @implementation FLEXIvar (Compare)
  20. - (NSComparisonResult)compare:(FLEXIvar *)other {
  21. return [self.name caseInsensitiveCompare:other.name];
  22. }
  23. @end
  24. @implementation FLEXMethodBase (Compare)
  25. - (NSComparisonResult)compare:(FLEXMethodBase *)other {
  26. return [self.name caseInsensitiveCompare:other.name];
  27. }
  28. @end
  29. @implementation FLEXProtocol (Compare)
  30. - (NSComparisonResult)compare:(FLEXProtocol *)other {
  31. return [self.name caseInsensitiveCompare:other.name];
  32. }
  33. @end