Improved the objective-c and swift api

Summary:
Compared to what was planned, I added the `overflow` value which seemed missing. I had to modify the implementation a bit for all values which are backed by a `YGValue`, but we should probably enable the pixel dimensions in Objective-C and Swift somehow later.
Closes https://github.com/facebook/yoga/pull/322

Reviewed By: cosmin1123

Differential Revision: D4391434

Pulled By: emilsjolander

fbshipit-source-id: e33f6f7b2bbaad29553100b7a5bb424496372110
This commit is contained in:
David Hart
2017-01-08 11:42:43 -08:00
committed by Facebook Github Bot
parent 8ed71b2777
commit 9982295e10
13 changed files with 765 additions and 607 deletions

View File

@@ -119,21 +119,21 @@ def to_java_upper(symbol):
root = os.path.dirname(os.path.abspath(__file__))
# write out C headers
# write out C & Objective-C headers
with open(root + '/yoga/YGEnums.h', 'w') as f:
f.write(LICENSE)
f.write('#pragma once\n\n')
f.write('#include "YGMacros.h"\n\n')
f.write('YG_EXTERN_C_BEGIN\n\n')
for name, values in ENUMS.items():
f.write('#define YG%sCount %s\n' % (name, len(values)))
f.write('typedef enum YG%s {\n' % name)
f.write('#define YG%sCount %s\n' % (name, len(values)))
f.write('typedef YG_ENUM_BEGIN(YG%s) {\n' % name)
for value in values:
if isinstance(value, tuple):
f.write(' YG%s%s = %d,\n' % (name, value[0], value[1]))
else:
f.write(' YG%s%s,\n' % (name, value))
f.write('} YG%s;\n' % name)
f.write('} YG_ENUM_END(YG%s);\n' % name)
f.write('\n')
f.write('YG_EXTERN_C_END\n')