react-native-navigation的迁移库

123456789101112131415161718192021222324252627282930313233
  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. + (NSNumber *)getCurrentTimestamp {
  25. return [NSNumber numberWithLong:[[NSDate date] timeIntervalSince1970] * 1000];
  26. }
  27. @end