Skip to content

Commit

Permalink
Add Float and Int type support for iOS modules (#42125)
Browse files Browse the repository at this point in the history
Summary:

This diff changes how numeric types are generated for Objective-C native modules.
Before this diff:
|Codegen Type|Objective-C Type|
| -- | -- |
|number|double|
|Float|double|
|Double|double|
|Int32|double|
After this diff:
|Codegen Type|Objective-C Type|
| -- | -- |
|number|double|
|Float|**float**|
|Double|double|
|Int32|**NSInteger**|

Changelog: [iOS][Breaking] - Codegen: mapping for numeric types is changed for Objective-C native modules. `Float` -> `float`; `Int32` -> `NSInteger`.

Differential Revision: D52479442
  • Loading branch information
dmytrorykun authored and facebook-github-bot committed Jan 3, 2024
1 parent e8ec957 commit dfdc71e
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,11 @@ function getParamObjCType(
case 'NumberTypeAnnotation':
return isRequired ? 'double' : 'NSNumber *';
case 'FloatTypeAnnotation':
return isRequired ? 'double' : 'NSNumber *';
return isRequired ? 'float' : 'NSNumber *';
case 'DoubleTypeAnnotation':
return isRequired ? 'double' : 'NSNumber *';
case 'Int32TypeAnnotation':
return isRequired ? 'double' : 'NSNumber *';
return isRequired ? 'NSInteger' : 'NSNumber *';
case 'BooleanTypeAnnotation':
return isRequired ? 'BOOL' : 'NSNumber *';
case 'EnumDeclaration':
Expand Down

0 comments on commit dfdc71e

Please sign in to comment.