From 9fe20fd2fc457178949ce3f9366fef69d6c4a5f1 Mon Sep 17 00:00:00 2001 From: Nate Stedman Date: Tue, 24 Jul 2018 06:47:20 -0700 Subject: [PATCH] Also ban +new on YGLayout Summary: `-init` is marked unavailable, but `+new` does the same thing and is not. Reviewed By: dshahidehpour Differential Revision: D8957391 fbshipit-source-id: 42fcfe845db79726d8724efd9f6a4d37c19938ad --- YogaKit/Source/YGLayout.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/YogaKit/Source/YGLayout.h b/YogaKit/Source/YGLayout.h index 7b9d583a..3bfb1b89 100644 --- a/YogaKit/Source/YGLayout.h +++ b/YogaKit/Source/YGLayout.h @@ -33,6 +33,13 @@ typedef NS_OPTIONS(NSInteger, YGDimensionFlexibility) { - (instancetype)init __attribute__((unavailable("you are not meant to initialise YGLayout"))); +/** + 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)new + __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.