ASEqualityHelpers.h 867 B

1234567891011121314151617181920212223
  1. //
  2. // ASEqualityHelpers.h
  3. // AsyncDisplayKit
  4. //
  5. // Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
  6. // This source code is licensed under the BSD-style license found in the
  7. // LICENSE file in the root directory of this source tree. An additional grant
  8. // of patent rights can be found in the PATENTS file in the same directory.
  9. //
  10. #import "ASBaseDefines.h"
  11. /**
  12. @abstract Correctly equates two objects, including cases where both objects are nil. The latter is a case where `isEqual:` fails.
  13. @param obj The first object in the comparison. Can be nil.
  14. @param otherObj The second object in the comparison. Can be nil.
  15. @result YES if the objects are equal, including cases where both object are nil.
  16. */
  17. ASDISPLAYNODE_INLINE BOOL ASObjectIsEqual(id<NSObject> obj, id<NSObject> otherObj)
  18. {
  19. return obj == otherObj || [obj isEqual:otherObj];
  20. }