Commit 52fb835f authored by David黄金龙's avatar David黄金龙

删除 不使用的文件

parent ef7c571d
......@@ -32,7 +32,6 @@
A52DF0C72B330A20006618D6 /* UIFont-Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = A52DEEB82B330A1F006618D6 /* UIFont-Extension.swift */; };
A52DF0C92B330A20006618D6 /* AlignedCollectionViewFlowLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = A52DEEBA2B330A1F006618D6 /* AlignedCollectionViewFlowLayout.swift */; };
A52DF0CA2B330A20006618D6 /* UIViewController+Navigation.swift in Sources */ = {isa = PBXBuildFile; fileRef = A52DEEBB2B330A1F006618D6 /* UIViewController+Navigation.swift */; };
A52DF0CB2B330A20006618D6 /* UIView-Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = A52DEEBC2B330A1F006618D6 /* UIView-Extension.swift */; };
A52DF0CC2B330A20006618D6 /* UIImage-Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = A52DEEBD2B330A1F006618D6 /* UIImage-Extension.swift */; };
A52DF0CD2B330A20006618D6 /* YhGestureTableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A52DEEBE2B330A1F006618D6 /* YhGestureTableView.swift */; };
A52DF0CE2B330A20006618D6 /* YhOverlayView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A52DEEBF2B330A1F006618D6 /* YhOverlayView.swift */; };
......@@ -108,7 +107,6 @@
A52DEEB82B330A1F006618D6 /* UIFont-Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIFont-Extension.swift"; sourceTree = "<group>"; };
A52DEEBA2B330A1F006618D6 /* AlignedCollectionViewFlowLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AlignedCollectionViewFlowLayout.swift; sourceTree = "<group>"; };
A52DEEBB2B330A1F006618D6 /* UIViewController+Navigation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIViewController+Navigation.swift"; sourceTree = "<group>"; };
A52DEEBC2B330A1F006618D6 /* UIView-Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView-Extension.swift"; sourceTree = "<group>"; };
A52DEEBD2B330A1F006618D6 /* UIImage-Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIImage-Extension.swift"; sourceTree = "<group>"; };
A52DEEBE2B330A1F006618D6 /* YhGestureTableView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YhGestureTableView.swift; sourceTree = "<group>"; };
A52DEEBF2B330A1F006618D6 /* YhOverlayView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YhOverlayView.swift; sourceTree = "<group>"; };
......@@ -317,7 +315,6 @@
A52DEEB82B330A1F006618D6 /* UIFont-Extension.swift */,
A52DEEBA2B330A1F006618D6 /* AlignedCollectionViewFlowLayout.swift */,
A52DEEBB2B330A1F006618D6 /* UIViewController+Navigation.swift */,
A52DEEBC2B330A1F006618D6 /* UIView-Extension.swift */,
A52DEEBD2B330A1F006618D6 /* UIImage-Extension.swift */,
A52DEEBE2B330A1F006618D6 /* YhGestureTableView.swift */,
A52DEEBF2B330A1F006618D6 /* YhOverlayView.swift */,
......@@ -662,7 +659,6 @@
A52DF0CD2B330A20006618D6 /* YhGestureTableView.swift in Sources */,
A52DF0DD2B330A20006618D6 /* YhConstant.swift in Sources */,
A52DF2512B33177F006618D6 /* BsHUDErrorView.swift in Sources */,
A52DF0CB2B330A20006618D6 /* UIView-Extension.swift in Sources */,
A52DF24D2B33177F006618D6 /* BsHUDWariningView.swift in Sources */,
A52DF0C32B330A20006618D6 /* YhCacheTool.swift in Sources */,
A52DF24A2B33177F006618D6 /* BsHUDContainerView.swift in Sources */,
......
......@@ -125,8 +125,7 @@ open class AlignedCollectionViewFlowLayout: UICollectionViewFlowLayout {
break
}
@unknown default:
print("123")
break
fatalError()
}
// It's safe to force-unwrap as `.leading` and `.trailing` are covered
......
//
// UIView-Extension.swift
// BaiSiSMApp
//
// Created by davidhuang on 2022/10/16.
// Copyright © 2022 www.davidhuang.com. All rights reserved.
//
import UIKit
extension UIView {
// MARK: - 旋转
func rotate( begin : Bool = true) {
if begin == true {
let rotation : CABasicAnimation = CABasicAnimation(keyPath:"transform.rotation.z")
rotation.toValue = NSNumber(value: Double.pi * 2)
rotation.duration = 3
rotation.isCumulative = true
rotation.repeatCount = Float.greatestFiniteMagnitude
rotation.fillMode = CAMediaTimingFillMode(rawValue: "forwards")
layer.add(rotation, forKey:"rotationAnimation")
} else {
layer.removeAllAnimations()
}
}
// MARK: - 获取当前UIview 所在的 UIViewController
func getFirstViewController()->UIViewController?{
for view in sequence(first: self.superview, next: {$0?.superview}){
if let responder = view?.next{
if responder.isKind(of: UIViewController.self){
return responder as? UIViewController
}
}
}
return nil
}
}
// MARK: - 阴影设置
extension UIView {
@objc public enum ShadowType: Int {
case all = 0 ///四周
case top = 1 ///上方
case left = 2///左边
case right = 3///右边
case bottom = 4///下方
}
///默认设置:黑色阴影, 阴影所占视图的比例
// func shadow(_ type: ShadowType, percent: Float) {
// shadow(type: type, color: .black, opactiy: 0.4, //shadowSize: 4)
//}
///默认设置:黑色阴影
@objc func shadow(_ type: ShadowType) {
shadow(type: type, color: .black, opactiy: 0.1, shadowSize: 4)
}
///阴影设置
@objc public func shadow(type: ShadowType, color: UIColor, opactiy: Float, shadowSize: CGFloat) -> Void {
layer.masksToBounds = false;//必须要等于NO否则会把阴影切割隐藏掉
layer.shadowColor = color.cgColor;// 阴影颜色
layer.shadowOpacity = opactiy;// 阴影透明度,默认0
layer.shadowOffset = .zero;//shadowOffset阴影偏移,默认(0, -3),这个跟shadowRadius配合使用
layer.shadowRadius = 3 //阴影半径,默认3
var shadowRect: CGRect?
switch type {
case .all:
shadowRect = CGRect.init(x: -shadowSize, y: -shadowSize, width: bounds.size.width + 2 * shadowSize, height: bounds.size.height + 2 * shadowSize)
case .top:
shadowRect = CGRect.init(x: -shadowSize, y: -shadowSize, width: bounds.size.width + 2 * shadowSize, height: 2 * shadowSize)
case .bottom:
shadowRect = CGRect.init(x: -shadowSize, y: bounds.size.height - shadowSize, width: bounds.size.width + 2 * shadowSize, height: 2 * shadowSize)
case .left:
shadowRect = CGRect.init(x: -shadowSize, y: -shadowSize, width: 2 * shadowSize, height: bounds.size.height + 2 * shadowSize)
case .right:
shadowRect = CGRect.init(x: bounds.size.width - shadowSize, y: -shadowSize, width: 2 * shadowSize, height: bounds.size.height + 2 * shadowSize)
}
layer.shadowPath = UIBezierPath.init(rect: shadowRect!).cgPath
}
///阴影 0.5
@objc public func bs_shadow(color: UIColor = UIColor(red: 0.87, green: 0.87, blue: 0.87, alpha: 0.7), offset: CGSize = CGSize(width: 0, height: 1.5), opacity: Float = 1, radius: CGFloat = 3.5) {
self.layer.shadowColor = color.cgColor
self.layer.shadowOffset = offset
self.layer.shadowOpacity = opacity
self.layer.shadowRadius = radius
}
///内阴影
@objc public func bs_innerShadow() {
self.layer.shadowColor = UIColor(red: 0.87, green: 0.87, blue: 0.87, alpha: 0.5).cgColor
self.layer.shadowOffset = CGSize(width: 0, height: 0)
self.layer.shadowOpacity = 1
self.layer.shadowRadius = 3
}
}
// MARK: - 圆角设置
extension UIView {
public func setCorners(corners: UIRectCorner, radius: CGFloat) -> Void {
self.setCorners(corners: corners, radius: radius, rect: self.bounds)
}
public func setCorners(corners: UIRectCorner, radius: CGFloat, rect: CGRect) -> Void {
let path = UIBezierPath.init(roundedRect: rect, byRoundingCorners: corners , cornerRadii: CGSize.init(width: radius, height: radius))
let layer = CAShapeLayer.init()
layer.frame = self.bounds
layer.path = path.cgPath
self.layer.mask = layer
}
///渐变颜色(frame需要有值)
@objc public func bs_gradient(_ type: ShadowType = .left, colors: [UIColor], locations: [NSNumber]? = nil) {
let gradientLayer = CAGradientLayer()
gradientLayer.frame = self.bounds
//设置颜色
var cgColors: [CGColor] = []
for color in colors {
cgColors.append(color.cgColor)
}
gradientLayer.colors = cgColors
//设置占比
if locations == nil {
let num = 1.0/(Double(colors.count)-1.0)
var locations: [NSNumber] = []
for i in 0..<colors.count {
locations.append(NSNumber(value: num*Double(i)))
}
gradientLayer.locations = locations
} else {
gradientLayer.locations = locations
}
//设置位置
switch type {
case .all:
gradientLayer.startPoint = CGPoint(x: 0.5, y: 0.5)
gradientLayer.endPoint = CGPoint(x: 0.5, y: 0.5)
case .top:
gradientLayer.startPoint = CGPoint(x: 0.5, y: 0)
gradientLayer.endPoint = CGPoint(x: 0.5, y: 1)
break
case .left:
gradientLayer.startPoint = CGPoint(x: 0, y: 0.5)
gradientLayer.endPoint = CGPoint(x: 1, y: 0.5)
break
case .right:
gradientLayer.startPoint = CGPoint(x: 1, y: 0.5)
gradientLayer.endPoint = CGPoint(x: 0, y: 0.5)
break
case .bottom:
gradientLayer.startPoint = CGPoint(x: 0.5, y: 1)
gradientLayer.endPoint = CGPoint(x: 0.5, y: 0)
break
}
self.layer.addSublayer(gradientLayer)
}
/// 绘制虚线
/// - Parameters:
/// - lineLength: 长度
/// - lineSpacing: 间隔长度
/// - lineColor: 颜色
public func bs_drawDashLine(lineLength: Int, lineSpacing: Int, lineColor: UIColor) {
let shapeLayer = CAShapeLayer()
shapeLayer.bounds = self.bounds
shapeLayer.anchorPoint = CGPoint(x: 0, y: 0)
shapeLayer.strokeColor = lineColor.cgColor
shapeLayer.lineWidth = 1 //描边路径时使用的线宽。默认为1。
shapeLayer.lineJoin = CAShapeLayerLineJoin.round
shapeLayer.lineDashPattern = [NSNumber(value: lineLength),NSNumber(value: lineSpacing)]
let path = CGMutablePath()
path.move(to: CGPoint(x: 0, y: 0))
path.addLine(to: CGPoint(x: self.bounds.size.width, y: 0))
shapeLayer.path = path
self.layer.addSublayer(shapeLayer)
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment