Hide init of YGLayout
Summary: Make default init unavailable, as it will not initialise `YGNode` which is required for the setters and getters of YGLayout's properties to work properly. In setters and getters we call the corresponding `YGNode`'s setters and getters. Thus the following code will crash ``` let layout = YGLayout() layout.flexDirection = .row ``` Reviewed By: emilsjolander Differential Revision: D6597796 fbshipit-source-id: 653d275d7314bfdd7a1106884fa3fbc0a13e1be7
This commit is contained in:
committed by
Facebook Github Bot
parent
dbc47ae383
commit
dbf6a12134
@@ -29,7 +29,15 @@ typedef NS_OPTIONS(NSInteger, YGDimensionFlexibility) {
|
|||||||
@interface YGLayout : NSObject
|
@interface YGLayout : NSObject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The property that decides if we should include this view when calculating layout. Defaults to YES.
|
Make default init unavailable, as it will not initialise YGNode which is
|
||||||
|
required for the setters and getters of YGLayout's properties to work properly.
|
||||||
|
*/
|
||||||
|
- (instancetype)init
|
||||||
|
__attribute__((unavailable("you are not meant to initialise YGLayout")));
|
||||||
|
|
||||||
|
/**
|
||||||
|
The property that decides if we should include this view when calculating
|
||||||
|
layout. Defaults to YES.
|
||||||
*/
|
*/
|
||||||
@property (nonatomic, readwrite, assign, setter=setIncludedInLayout:) BOOL isIncludedInLayout;
|
@property (nonatomic, readwrite, assign, setter=setIncludedInLayout:) BOOL isIncludedInLayout;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user