Skip to content

Commit b0164b9

Browse files
committed
FloatingPanelBackdropView supports UIAppearance
1 parent c381b10 commit b0164b9

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

Framework/Sources/FloatingPanel.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ class FloatingPanel: NSObject, UIGestureRecognizerDelegate, UIScrollViewDelegate
7070
surfaceView = FloatingPanelSurfaceView()
7171

7272
backdropView = FloatingPanelBackdropView()
73-
backdropView.backgroundColor = .black
7473
backdropView.alpha = 0.0
7574

7675
self.layoutAdapter = FloatingPanelLayoutAdapter(surfaceView: surfaceView,

Framework/Sources/FloatingPanelBackdropView.swift

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,26 @@
66
import UIKit
77

88
/// A view that presents a backdrop interface behind a floating panel.
9-
public class FloatingPanelBackdropView: UIView { }
9+
public class FloatingPanelBackdropView: UIView {
10+
override init(frame: CGRect) {
11+
super.init(frame: frame)
12+
setUp()
13+
}
14+
15+
required public init?(coder aDecoder: NSCoder) {
16+
super.init(coder: aDecoder)
17+
setUp()
18+
}
19+
20+
private func setUp() {
21+
layer.backgroundColor = UIColor.black.cgColor
22+
}
23+
24+
@objc dynamic public override var backgroundColor: UIColor? {
25+
get {
26+
guard let color = layer.backgroundColor else { return nil }
27+
return UIColor(cgColor: color)
28+
}
29+
set { layer.backgroundColor = newValue?.cgColor }
30+
}
31+
}

0 commit comments

Comments
 (0)