Skip to content

Commit c381b10

Browse files
committed
FloatingPanelSurfaceView supports UIAppearance
1 parent 6fcb817 commit c381b10

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

Framework/Sources/FloatingPanel.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ class FloatingPanel: NSObject, UIGestureRecognizerDelegate, UIScrollViewDelegate
6868
viewcontroller = vc
6969

7070
surfaceView = FloatingPanelSurfaceView()
71-
surfaceView.backgroundColor = .white
7271

7372
backdropView = FloatingPanelBackdropView()
7473
backdropView.backgroundColor = .black

Framework/Sources/FloatingPanelSurfaceView.swift

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class FloatingPanelSurfaceView: UIView {
1515
public let grabberHandle: GrabberHandleView = GrabberHandleView()
1616

1717
/// Offset of the grabber handle from the top
18-
public var grabberTopPadding: CGFloat = 6.0 { didSet {
18+
@objc dynamic public var grabberTopPadding: CGFloat = 6.0 { didSet {
1919
setNeedsUpdateConstraints()
2020
} }
2121

@@ -25,10 +25,10 @@ public class FloatingPanelSurfaceView: UIView {
2525
}
2626

2727
/// Grabber view width and height
28-
public var grabberHandleWidth: CGFloat = 36.0 { didSet {
28+
@objc dynamic public var grabberHandleWidth: CGFloat = 36.0 { didSet {
2929
setNeedsUpdateConstraints()
3030
} }
31-
public var grabberHandleHeight: CGFloat = 5.0 { didSet {
31+
@objc dynamic public var grabberHandleHeight: CGFloat = 5.0 { didSet {
3232
setNeedsUpdateConstraints()
3333
} }
3434

@@ -48,7 +48,7 @@ public class FloatingPanelSurfaceView: UIView {
4848
private var color: UIColor? = .white { didSet { setNeedsLayout() } }
4949
var bottomOverflow: CGFloat = 0.0 // Must not call setNeedsLayout()
5050

51-
public override var backgroundColor: UIColor? {
51+
@objc dynamic public override var backgroundColor: UIColor? {
5252
get { return color }
5353
set { color = newValue }
5454
}
@@ -57,34 +57,34 @@ public class FloatingPanelSurfaceView: UIView {
5757
///
5858
/// `self.contentView` is masked with the top rounded corners automatically on iOS 11 and later.
5959
/// On iOS 10, they are not automatically masked because of a UIVisualEffectView issue. See https://forums.developer.apple.com/thread/50854
60-
public var cornerRadius: CGFloat {
60+
@objc dynamic public var cornerRadius: CGFloat {
6161
set { containerView.layer.cornerRadius = newValue; setNeedsLayout() }
6262
get { return containerView.layer.cornerRadius }
6363
}
6464

6565
/// A Boolean indicating whether the surface shadow is displayed.
66-
public var shadowHidden: Bool = false { didSet { setNeedsLayout() } }
66+
@objc dynamic public var shadowHidden: Bool = false { didSet { setNeedsLayout() } }
6767

6868
/// The color of the surface shadow.
69-
public var shadowColor: UIColor = .black { didSet { setNeedsLayout() } }
69+
@objc dynamic public var shadowColor: UIColor = .black { didSet { setNeedsLayout() } }
7070

7171
/// The offset (in points) of the surface shadow.
72-
public var shadowOffset: CGSize = CGSize(width: 0.0, height: 1.0) { didSet { setNeedsLayout() } }
72+
@objc dynamic public var shadowOffset: CGSize = CGSize(width: 0.0, height: 1.0) { didSet { setNeedsLayout() } }
7373

7474
/// The opacity of the surface shadow.
75-
public var shadowOpacity: Float = 0.2 { didSet { setNeedsLayout() } }
75+
@objc dynamic public var shadowOpacity: Float = 0.2 { didSet { setNeedsLayout() } }
7676

7777
/// The blur radius (in points) used to render the surface shadow.
78-
public var shadowRadius: CGFloat = 3 { didSet { setNeedsLayout() } }
78+
@objc dynamic public var shadowRadius: CGFloat = 3 { didSet { setNeedsLayout() } }
7979

8080
/// The width of the surface border.
81-
public var borderColor: UIColor? { didSet { setNeedsLayout() } }
81+
@objc dynamic public var borderColor: UIColor? { didSet { setNeedsLayout() } }
8282

8383
/// The color of the surface border.
84-
public var borderWidth: CGFloat = 0.0 { didSet { setNeedsLayout() } }
84+
@objc dynamic public var borderWidth: CGFloat = 0.0 { didSet { setNeedsLayout() } }
8585

8686
/// Offset of the container view from the top
87-
public var containerTopInset: CGFloat = 0.0 { didSet {
87+
@objc dynamic public var containerTopInset: CGFloat = 0.0 { didSet {
8888
setNeedsUpdateConstraints()
8989
} }
9090

@@ -141,7 +141,7 @@ public class FloatingPanelSurfaceView: UIView {
141141
addSubview(grabberHandle)
142142
grabberHandle.translatesAutoresizingMaskIntoConstraints = false
143143
NSLayoutConstraint.activate([
144-
grabberHandleWidthConstraint,
144+
rabberHandleWidthConstraint,
145145
grabberHandleHeightConstraint,
146146
grabberHandleTopConstraint,
147147
grabberHandle.centerXAnchor.constraint(equalTo: centerXAnchor),

0 commit comments

Comments
 (0)