2016-10-12 09:32:40 -07:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2016-12-19 01:13:16 +01:00
|
|
|
#import <YogaKit/UIView+YogaKit.h>
|
|
|
|
#import <YogaKit/YKLayout+Private.h>
|
2016-10-12 09:32:40 -07:00
|
|
|
#import <objc/runtime.h>
|
|
|
|
|
2016-12-18 21:05:43 +01:00
|
|
|
@implementation UIView (YogaKit)
|
2016-10-12 09:32:40 -07:00
|
|
|
|
2016-12-19 01:13:16 +01:00
|
|
|
- (YKLayout *)layout
|
2016-10-12 09:32:40 -07:00
|
|
|
{
|
2016-12-19 01:13:16 +01:00
|
|
|
YKLayout *layout = objc_getAssociatedObject(self, @selector(layout));
|
|
|
|
if (!layout) {
|
|
|
|
layout = [[YKLayout alloc] initWithView:self];
|
|
|
|
objc_setAssociatedObject(self, @selector(layout), layout, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
2016-11-22 08:27:03 -08:00
|
|
|
}
|
2016-12-19 01:13:16 +01:00
|
|
|
|
|
|
|
return layout;
|
2016-11-22 08:27:03 -08:00
|
|
|
}
|
|
|
|
|
2016-10-27 12:45:07 -07:00
|
|
|
|
|
|
|
@end
|