Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS build warnings] RCTConvert: Deprecated NSStringArray typedef #11799

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions React/Base/RCTConvert.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,18 @@ RCT_CUSTOM_CONVERTER(type, type, [RCT_DEBUG ? [self NSNumber:json] : json getter
}

/**
* This macro is used for creating converter functions for typed arrays.
* This macro is used for creating explicitly-named converter functions
* for typed arrays.
*/
#define RCT_ARRAY_CONVERTER(type) \
+ (NSArray<type *> *)type##Array:(id)json \
#define RCT_ARRAY_CONVERTER_NAMED(type, name) \
+ (NSArray<type *> *)name##Array:(id)json \
{ \
return RCTConvertArrayValue(@selector(type:), json); \
return RCTConvertArrayValue(@selector(name:), json); \
}

/**
* This macro is used for creating converter functions for typed arrays.
* RCT_ARRAY_CONVERTER_NAMED may be used when type contains characters
* which are disallowed in selector names.
*/
#define RCT_ARRAY_CONVERTER(type) RCT_ARRAY_CONVERTER_NAMED(type, type)
7 changes: 4 additions & 3 deletions React/Base/RCTConvert.m
Original file line number Diff line number Diff line change
Expand Up @@ -558,14 +558,15 @@ SEL RCTConvertSelectorForType(NSString *type)
* representable json array values that require no conversion.
*/
#if RCT_DEBUG
#define RCT_JSON_ARRAY_CONVERTER(type) RCT_ARRAY_CONVERTER(type)
#define RCT_JSON_ARRAY_CONVERTER_NAMED(type, name) RCT_ARRAY_CONVERTER_NAMED(type, name)
#else
#define RCT_JSON_ARRAY_CONVERTER(type) + (NSArray *)type##Array:(id)json { return json; }
#define RCT_JSON_ARRAY_CONVERTER_NAMED(type, name) + (NSArray *)name##Array:(id)json { return json; }
#endif
#define RCT_JSON_ARRAY_CONVERTER(type) RCT_JSON_ARRAY_CONVERTER_NAMED(type, type)

RCT_JSON_ARRAY_CONVERTER(NSArray)
RCT_JSON_ARRAY_CONVERTER(NSString)
RCT_JSON_ARRAY_CONVERTER(NSStringArray)
RCT_JSON_ARRAY_CONVERTER_NAMED(NSArray<NSString *>, NSStringArray)
RCT_JSON_ARRAY_CONVERTER(NSDictionary)
RCT_JSON_ARRAY_CONVERTER(NSNumber)

Expand Down