ASEqualityHelpers.h 834 B

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