Skip to content

Commit

Permalink
feat: Add EmptyRow
Browse files Browse the repository at this point in the history
  • Loading branch information
rakuyoMo committed Jun 18, 2024
1 parent 6b92cc4 commit 495a371
Showing 1 changed file with 74 additions and 0 deletions.
74 changes: 74 additions & 0 deletions Sources/Epoxy/Row/EmptyRow.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
//
// EmptyRow.swift
// RakuyoKit
//
// Created by Rakuyo on 2024/6/18.
// Copyright © 2024 RakuyoKit. All rights reserved.
//

#if !os(watchOS) && !os(tvOS) && !os(visionOS)
import UIKit

import EpoxyCore
import RAKBase
import RAKCore

// MARK: - EmptyRow

/// Blank View
///
/// It is not recommended that you inherit from this class
public final class EmptyRow: BaseStyledEpoxyView<EmptyRow.Style> { }

// MARK: Life cycle

extension EmptyRow {
override public var intrinsicContentSize: CGSize {
lazy var superSize = super.intrinsicContentSize
guard let size = style.size else { return superSize }

return .init(
width: size.width ?? superSize.width,
height: size.height ?? superSize.height
)
}
}

// MARK: Config

extension EmptyRow {
override public func config() {
super.config()

backgroundColor = style.backgroundColor

layer.cornerRadius = style.cornerRadius
layer.masksToBounds = style.masksToBounds
layer.borderWidth = style.borderWidth
layer.borderColor = style.borderColor?.cgColor
}
}

// MARK: StyledView

extension EmptyRow {
public struct Style: Hashable {
public let size: OptionalCGSize?
public let backgroundColor: UIColor?

public let cornerRadius: CGFloat
public let masksToBounds: Bool

public let borderWidth: CGFloat
public let borderColor: UIColor?
}
}

// MARK: ContentConfigurableView

extension EmptyRow: ContentConfigurableView { }

// MARK: BehaviorsConfigurableView

extension EmptyRow: BehaviorsConfigurableView { }
#endif

0 comments on commit 495a371

Please sign in to comment.