2021-02-04 08:09:58 +01:00
|
|
|
//
|
|
|
|
// UIView.swift
|
|
|
|
// Mastodon
|
|
|
|
//
|
|
|
|
// Created by sxiaojian on 2021/2/4.
|
|
|
|
//
|
|
|
|
|
|
|
|
import UIKit
|
|
|
|
|
2021-02-20 13:23:29 +01:00
|
|
|
// MARK: -Convinience view creation method
|
2021-02-04 08:09:58 +01:00
|
|
|
extension UIView {
|
|
|
|
|
|
|
|
static var separatorLine: UIView {
|
|
|
|
let line = UIView()
|
|
|
|
line.backgroundColor = .separator
|
|
|
|
return line
|
|
|
|
}
|
|
|
|
|
|
|
|
static func separatorLineHeight(of view: UIView) -> CGFloat {
|
|
|
|
return 1.0 / view.traitCollection.displayScale
|
|
|
|
}
|
|
|
|
|
|
|
|
static var floatyButtonBottomMargin: CGFloat {
|
|
|
|
return 16
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2021-02-20 13:23:29 +01:00
|
|
|
|
|
|
|
// MARK: -Convinience view appearance modification method
|
|
|
|
extension UIView {
|
|
|
|
@discardableResult
|
|
|
|
func applyCornerRadius(radius: CGFloat) -> Self {
|
|
|
|
layer.masksToBounds = true
|
|
|
|
layer.cornerRadius = radius
|
|
|
|
layer.cornerCurve = .continuous
|
|
|
|
return self
|
|
|
|
}
|
|
|
|
}
|