//
//  UIView+DDCategory.h
//  DDCategoryKit_Private
//  Created by DDIsFriend on 2022/7/29.

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface UIView (DDCategory)

@property (nonatomic, assign)CGFloat width;// view's width of size.
@property (nonatomic, assign)CGFloat height;// view's height of size.
@property (nonatomic, assign)CGFloat x;// view's x of origin.
@property (nonatomic, assign)CGFloat y;// view's y of origin.

@end

@interface UIView (Layer)
/**
 * give the view shadow
 *@param shadowColor layer shadowColor
 *@param shadowOffset layer shadowOffset
 *@param shadowRadius layer shadowRadius
 *@param shadowOpacity layer shadowOpacity
 *@param viewBackgroundColor you must set viewBackgroundColor,otherwise shadow can not be show.
 *@param cornerRadius this property maybe cooperate with maskToBounds, such as imageView, you can not set maskToBounds to yes when you set shadow, they are mutually exclusive.
 *@warning this function maybe effect fps, you should set rasterize to reduce impact. and you can set shadowPath to reduce consumption of cpu. the viewBackgroundColor must be setted.
 */

+ (UIView *)dd_layerWithShadowColor:(CGColorRef)shadowColor shadowOffset:(CGSize)shadowOffset shadowRadius:(CGFloat)shadowRadius shadowOpacity:(CGFloat)shadowOpacity  cornerRadius:(CGFloat)cornerRadius viewBackgroundColor:(nullable UIColor *)viewBackgroundColor;
/**
 *the view transfer this function must already has setted background.
 */
- (void)dd_layerWithShadowColor:(CGColorRef)shadowColor shadowOffset:(CGSize)shadowOffset shadowRadius:(CGFloat)shadowRadius shadowOpacity:(CGFloat)shadowOpacity  cornerRadius:(CGFloat)cornerRadius viewBackgroundColor:(nullable UIColor *)viewBackgroundColor;
@end

@interface UIView (Controller)
/// 当前view所在的控制器
@property (nonatomic, strong, readonly,nullable)UIViewController *dd_currentViewController;

/// 获取某个view所在的控制器
+ (nullable UIViewController *)dd_viewControllerOfView:(nonnull UIView *)view;
@end

NS_ASSUME_NONNULL_END
