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:
Pull Request resolved: #42125

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`.

Reviewed By: cipolleschi

Differential Revision: D52479442

fbshipit-source-id: 1b2e101a9593a75c7c19b0da3a01a0e592a35ba5
  • Loading branch information
dmytrorykun authored and facebook-github-bot committed Jan 4, 2024
1 parent 7c444de commit 5aa425c
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,11 @@ function getParamObjCType(
case 'NumberTypeAnnotation':
return notStruct(isRequired ? 'double' : 'NSNumber *');
case 'FloatTypeAnnotation':
return notStruct(isRequired ? 'double' : 'NSNumber *');
return notStruct(isRequired ? 'float' : 'NSNumber *');
case 'DoubleTypeAnnotation':
return notStruct(isRequired ? 'double' : 'NSNumber *');
case 'Int32TypeAnnotation':
return notStruct(isRequired ? 'double' : 'NSNumber *');
return notStruct(isRequired ? 'NSInteger' : 'NSNumber *');
case 'BooleanTypeAnnotation':
return notStruct(isRequired ? 'BOOL' : 'NSNumber *');
case 'EnumDeclaration':
Expand Down

0 comments on commit 5aa425c

Please sign in to comment.