@@ -58,6 +58,7 @@ class DayCell: JTACDayCell {
5858 // MARK: - Variables
5959
6060 private var config : FastisConfig . DayCell = FastisConfig . default. dayCell
61+ private var rangedBackgroundViewTopBootomConstraints : [ Constraint ] = [ ]
6162
6263 // MARK: - Lifecycle
6364
@@ -85,6 +86,10 @@ class DayCell: JTACDayCell {
8586 self . selectionBackgroundView. backgroundColor = config. selectedBackgroundColor
8687 self . dateLabel. font = config. dateLabelFont
8788 self . dateLabel. textColor = config. dateLabelColor
89+ if let cornerRadius = config. customSelectionViewCornerRadius {
90+ self . selectionBackgroundView. layer. cornerRadius = cornerRadius
91+ }
92+ rangedBackgroundViewTopBootomConstraints. map { $0. update ( inset: config. rangedBackgroundViewInset) }
8893 }
8994
9095 public func configureSubviews( ) {
@@ -98,24 +103,25 @@ class DayCell: JTACDayCell {
98103 }
99104
100105 public func configureConstraints( ) {
106+ let inset = config. rangedBackgroundViewInset
101107 self . rangedBackgroundViewRoundedLeft. snp. makeConstraints { ( maker) in
102108 maker. left. equalToSuperview ( )
103- maker. bottom. top. equalToSuperview ( ) . inset ( 3 )
109+ rangedBackgroundViewTopBootomConstraints . append ( maker. bottom. top. equalToSuperview ( ) . inset ( inset ) . constraint )
104110 maker. width. equalToSuperview ( ) . dividedBy ( 2 )
105111 }
106112 self . rangedBackgroundViewSquaredLeft. snp. makeConstraints { ( maker) in
107113 maker. left. equalToSuperview ( )
108- maker. bottom. top. equalToSuperview ( ) . inset ( 3 )
114+ rangedBackgroundViewTopBootomConstraints . append ( maker. bottom. top. equalToSuperview ( ) . inset ( inset ) . constraint )
109115 maker. width. equalToSuperview ( ) . dividedBy ( 2 )
110116 }
111117 self . rangedBackgroundViewRoundedRight. snp. makeConstraints { ( maker) in
112118 maker. right. equalToSuperview ( )
113- maker. bottom. top. equalToSuperview ( ) . inset ( 3 )
119+ rangedBackgroundViewTopBootomConstraints . append ( maker. bottom. top. equalToSuperview ( ) . inset ( inset ) . constraint )
114120 maker. width. equalToSuperview ( ) . dividedBy ( 2 )
115121 }
116122 self . rangedBackgroundViewSquaredRight. snp. makeConstraints { ( maker) in
117123 maker. right. equalToSuperview ( )
118- maker. bottom. top. equalToSuperview ( ) . inset ( 3 )
124+ rangedBackgroundViewTopBootomConstraints . append ( maker. bottom. top. equalToSuperview ( ) . inset ( inset ) . constraint )
119125 maker. width. equalToSuperview ( ) . dividedBy ( 2 )
120126 }
121127 self . selectionBackgroundView. snp. makeConstraints { ( maker) in
@@ -307,9 +313,12 @@ extension FastisConfig {
307313 public var rangeViewCornerRadius : CGFloat = 6
308314 public var onRangeBackgroundColor : UIColor = UIColor . systemBlue. withAlphaComponent ( 0.2 )
309315 public var onRangeLabelColor : UIColor = . black
316+ public var rangedBackgroundViewInset : CGFloat = 3
310317
318+ /**
319+ This property allows to set custom radius for selection view. Circle is default.
320+ */
321+ public var customSelectionViewCornerRadius : CGFloat ?
311322 }
312-
313- }
314-
315323
324+ }
0 commit comments