react-native-navigation的迁移库

1234567891011121314151617181920212223242526
  1. #import "RNNUtils.h"
  2. @implementation RNNUtils
  3. +(double)getDoubleOrKey:(NSDictionary*)dict withKey:(NSString*)key withDefault:(double)defaultResult {
  4. if ([dict objectForKey:key]) {
  5. return [dict[key] doubleValue];
  6. } else {
  7. return defaultResult;
  8. }
  9. }
  10. +(BOOL)getBoolOrKey:(NSDictionary*)dict withKey:(NSString*)key withDefault:(BOOL)defaultResult {
  11. if ([dict objectForKey:key]) {
  12. return [dict[key] boolValue];
  13. } else {
  14. return defaultResult;
  15. }
  16. }
  17. +(id)getObjectOrKey:(NSDictionary*)dict withKey:(NSString*)key withDefault:(id)defaultResult {
  18. if ([dict objectForKey:key]) {
  19. return dict[key];
  20. } else {
  21. return defaultResult;
  22. }
  23. }
  24. @end