Files
suixinkan_uikit/suixinkan/UI/Common/AppCardView.swift

45 lines
1.1 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// AppCardView.swift
// suixinkan
//
import SnapKit
import UIKit
///
final class AppCardView: UIView {
/// container
let contentView = UIView()
private let showsBorder: Bool
/// - Parameter showsBorder: 1px falseflat
init(showsBorder: Bool = false) {
self.showsBorder = showsBorder
super.init(frame: .zero)
setupUI()
}
@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func setupUI() {
backgroundColor = AppColor.cardBackground
layer.cornerRadius = AppRadius.md
clipsToBounds = true
if showsBorder {
layer.borderWidth = 1
layer.borderColor = AppColor.cardOutline.cgColor
}
addSubview(contentView)
contentView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
}
}