improved the objective-c and swift api

This commit is contained in:
David Hart
2017-01-06 00:21:41 +01:00
parent a36faf89e3
commit 35ceb973bb
14 changed files with 874 additions and 584 deletions

View File

@@ -14,28 +14,54 @@
YG_EXTERN_C_BEGIN
#define YGFlexDirectionCount 4
#ifndef NS_ENUM
typedef enum YGFlexDirection {
YGFlexDirectionColumn,
YGFlexDirectionColumnReverse,
YGFlexDirectionRow,
YGFlexDirectionRowReverse,
} YGFlexDirection;
#else
typedef NS_ENUM(NSInteger, YGFlexDirection) {
YGFlexDirectionColumn,
YGFlexDirectionColumnReverse,
YGFlexDirectionRow,
YGFlexDirectionRowReverse,
};
#endif
#define YGMeasureModeCount 3
#ifndef NS_ENUM
typedef enum YGMeasureMode {
YGMeasureModeUndefined,
YGMeasureModeExactly,
YGMeasureModeAtMost,
} YGMeasureMode;
#else
typedef NS_ENUM(NSInteger, YGMeasureMode) {
YGMeasureModeUndefined,
YGMeasureModeExactly,
YGMeasureModeAtMost,
};
#endif
#define YGPrintOptionsCount 3
#ifndef NS_ENUM
typedef enum YGPrintOptions {
YGPrintOptionsLayout = 1,
YGPrintOptionsStyle = 2,
YGPrintOptionsChildren = 4,
} YGPrintOptions;
#else
typedef NS_ENUM(NSInteger, YGPrintOptions) {
YGPrintOptionsLayout = 1,
YGPrintOptionsStyle = 2,
YGPrintOptionsChildren = 4,
};
#endif
#define YGEdgeCount 9
#ifndef NS_ENUM
typedef enum YGEdge {
YGEdgeLeft,
YGEdgeTop,
@@ -47,20 +73,48 @@ typedef enum YGEdge {
YGEdgeVertical,
YGEdgeAll,
} YGEdge;
#else
typedef NS_ENUM(NSInteger, YGEdge) {
YGEdgeLeft,
YGEdgeTop,
YGEdgeRight,
YGEdgeBottom,
YGEdgeStart,
YGEdgeEnd,
YGEdgeHorizontal,
YGEdgeVertical,
YGEdgeAll,
};
#endif
#define YGPositionTypeCount 2
#ifndef NS_ENUM
typedef enum YGPositionType {
YGPositionTypeRelative,
YGPositionTypeAbsolute,
} YGPositionType;
#else
typedef NS_ENUM(NSInteger, YGPositionType) {
YGPositionTypeRelative,
YGPositionTypeAbsolute,
};
#endif
#define YGDimensionCount 2
#ifndef NS_ENUM
typedef enum YGDimension {
YGDimensionWidth,
YGDimensionHeight,
} YGDimension;
#else
typedef NS_ENUM(NSInteger, YGDimension) {
YGDimensionWidth,
YGDimensionHeight,
};
#endif
#define YGJustifyCount 5
#ifndef NS_ENUM
typedef enum YGJustify {
YGJustifyFlexStart,
YGJustifyCenter,
@@ -68,15 +122,33 @@ typedef enum YGJustify {
YGJustifySpaceBetween,
YGJustifySpaceAround,
} YGJustify;
#else
typedef NS_ENUM(NSInteger, YGJustify) {
YGJustifyFlexStart,
YGJustifyCenter,
YGJustifyFlexEnd,
YGJustifySpaceBetween,
YGJustifySpaceAround,
};
#endif
#define YGDirectionCount 3
#ifndef NS_ENUM
typedef enum YGDirection {
YGDirectionInherit,
YGDirectionLTR,
YGDirectionRTL,
} YGDirection;
#else
typedef NS_ENUM(NSInteger, YGDirection) {
YGDirectionInherit,
YGDirectionLTR,
YGDirectionRTL,
};
#endif
#define YGLogLevelCount 5
#ifndef NS_ENUM
typedef enum YGLogLevel {
YGLogLevelError,
YGLogLevelWarn,
@@ -84,27 +156,59 @@ typedef enum YGLogLevel {
YGLogLevelDebug,
YGLogLevelVerbose,
} YGLogLevel;
#else
typedef NS_ENUM(NSInteger, YGLogLevel) {
YGLogLevelError,
YGLogLevelWarn,
YGLogLevelInfo,
YGLogLevelDebug,
YGLogLevelVerbose,
};
#endif
#define YGWrapCount 2
#ifndef NS_ENUM
typedef enum YGWrap {
YGWrapNoWrap,
YGWrapWrap,
} YGWrap;
#else
typedef NS_ENUM(NSInteger, YGWrap) {
YGWrapNoWrap,
YGWrapWrap,
};
#endif
#define YGOverflowCount 3
#ifndef NS_ENUM
typedef enum YGOverflow {
YGOverflowVisible,
YGOverflowHidden,
YGOverflowScroll,
} YGOverflow;
#else
typedef NS_ENUM(NSInteger, YGOverflow) {
YGOverflowVisible,
YGOverflowHidden,
YGOverflowScroll,
};
#endif
#define YGExperimentalFeatureCount 2
#ifndef NS_ENUM
typedef enum YGExperimentalFeature {
YGExperimentalFeatureRounding,
YGExperimentalFeatureWebFlexBasis,
} YGExperimentalFeature;
#else
typedef NS_ENUM(NSInteger, YGExperimentalFeature) {
YGExperimentalFeatureRounding,
YGExperimentalFeatureWebFlexBasis,
};
#endif
#define YGAlignCount 5
#ifndef NS_ENUM
typedef enum YGAlign {
YGAlignAuto,
YGAlignFlexStart,
@@ -112,12 +216,29 @@ typedef enum YGAlign {
YGAlignFlexEnd,
YGAlignStretch,
} YGAlign;
#else
typedef NS_ENUM(NSInteger, YGAlign) {
YGAlignAuto,
YGAlignFlexStart,
YGAlignCenter,
YGAlignFlexEnd,
YGAlignStretch,
};
#endif
#define YGUnitCount 3
#ifndef NS_ENUM
typedef enum YGUnit {
YGUnitUndefined,
YGUnitPixel,
YGUnitPercent,
} YGUnit;
#else
typedef NS_ENUM(NSInteger, YGUnit) {
YGUnitUndefined,
YGUnitPixel,
YGUnitPercent,
};
#endif
YG_EXTERN_C_END