Summary: It is very inconvenient to enter block attribute name for each view in Objective-C. Closes https://github.com/facebook/yoga/pull/618 Differential Revision: D6408138 Pulled By: emilsjolander fbshipit-source-id: 71fe8eadda7233e5055560667d0fc3840ab7259b
39 lines
1.1 KiB
Objective-C
39 lines
1.1 KiB
Objective-C
/**
|
|
* Copyright (c) 2014-present, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*/
|
|
|
|
#import "YGLayout.h"
|
|
#import <UIKit/UIKit.h>
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
typedef void (^YGLayoutConfigurationBlock)(YGLayout *layout);
|
|
|
|
@interface UIView (Yoga)
|
|
|
|
/**
|
|
The YGLayout that is attached to this view. It is lazily created.
|
|
*/
|
|
@property (nonatomic, readonly, strong) YGLayout *yoga;
|
|
/**
|
|
Indicates whether or not Yoga is enabled
|
|
*/
|
|
@property (nonatomic, readonly, assign) BOOL isYogaEnabled;
|
|
|
|
/**
|
|
In ObjC land, every time you access `view.yoga.*` you are adding another `objc_msgSend`
|
|
to your code. If you plan on making multiple changes to YGLayout, it's more performant
|
|
to use this method, which uses a single objc_msgSend call.
|
|
*/
|
|
- (void)configureLayoutWithBlock:(YGLayoutConfigurationBlock)block
|
|
NS_SWIFT_NAME(configureLayout(block:));
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|