Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2b05ea8d92 | |||
| d255e1ea4a |
@@ -4,18 +4,8 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import FloatingPanel
|
||||
|
||||
@UIApplicationMain
|
||||
class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
var window: UIWindow?
|
||||
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
|
||||
FloatingPanelSurfaceView.appearance().shadowHidden = false
|
||||
FloatingPanelSurfaceView.appearance().cornerRadius = 6.0
|
||||
// FloatingPanelSurfaceView.appearance().backgroundColor = .lightGray
|
||||
// FloatingPanelBackdropView.appearance().backgroundColor = .red
|
||||
// GrabberHandleView.appearance().barColor = .red
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,6 +123,10 @@ class SampleListViewController: UIViewController {
|
||||
mainPanelVC = FloatingPanelController()
|
||||
mainPanelVC.delegate = self
|
||||
|
||||
// Initialize FloatingPanelController and add the view
|
||||
mainPanelVC.surfaceView.cornerRadius = 6.0
|
||||
mainPanelVC.surfaceView.shadowHidden = false
|
||||
|
||||
// Set a content view controller
|
||||
mainPanelVC.set(contentViewController: contentVC)
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Pod::Spec.new do |s|
|
||||
|
||||
s.name = "FloatingPanel"
|
||||
s.version = "1.5.1"
|
||||
s.version = "1.6.0"
|
||||
s.summary = "FloatingPanel is a clean and easy-to-use UI component of a floating panel interface."
|
||||
s.description = <<-DESC
|
||||
FloatingPanel is a clean and easy-to-use UI component for a new interface introduced in Apple Maps, Shortcuts and Stocks app.
|
||||
|
||||
@@ -68,8 +68,10 @@ class FloatingPanel: NSObject, UIGestureRecognizerDelegate, UIScrollViewDelegate
|
||||
viewcontroller = vc
|
||||
|
||||
surfaceView = FloatingPanelSurfaceView()
|
||||
surfaceView.backgroundColor = .white
|
||||
|
||||
backdropView = FloatingPanelBackdropView()
|
||||
backdropView.backgroundColor = .black
|
||||
backdropView.alpha = 0.0
|
||||
|
||||
self.layoutAdapter = FloatingPanelLayoutAdapter(surfaceView: surfaceView,
|
||||
|
||||
@@ -6,26 +6,4 @@
|
||||
import UIKit
|
||||
|
||||
/// A view that presents a backdrop interface behind a floating panel.
|
||||
public class FloatingPanelBackdropView: UIView {
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
setUp()
|
||||
}
|
||||
|
||||
required public init?(coder aDecoder: NSCoder) {
|
||||
super.init(coder: aDecoder)
|
||||
setUp()
|
||||
}
|
||||
|
||||
private func setUp() {
|
||||
layer.backgroundColor = UIColor.black.cgColor
|
||||
}
|
||||
|
||||
@objc dynamic public override var backgroundColor: UIColor? {
|
||||
get {
|
||||
guard let color = layer.backgroundColor else { return nil }
|
||||
return UIColor(cgColor: color)
|
||||
}
|
||||
set { layer.backgroundColor = newValue?.cgColor }
|
||||
}
|
||||
}
|
||||
public class FloatingPanelBackdropView: UIView { }
|
||||
|
||||
@@ -15,7 +15,7 @@ public class FloatingPanelSurfaceView: UIView {
|
||||
public let grabberHandle: GrabberHandleView = GrabberHandleView()
|
||||
|
||||
/// Offset of the grabber handle from the top
|
||||
@objc dynamic public var grabberTopPadding: CGFloat = 6.0 { didSet {
|
||||
public var grabberTopPadding: CGFloat = 6.0 { didSet {
|
||||
setNeedsUpdateConstraints()
|
||||
} }
|
||||
|
||||
@@ -25,10 +25,10 @@ public class FloatingPanelSurfaceView: UIView {
|
||||
}
|
||||
|
||||
/// Grabber view width and height
|
||||
@objc dynamic public var grabberHandleWidth: CGFloat = 36.0 { didSet {
|
||||
public var grabberHandleWidth: CGFloat = 36.0 { didSet {
|
||||
setNeedsUpdateConstraints()
|
||||
} }
|
||||
@objc dynamic public var grabberHandleHeight: CGFloat = 5.0 { didSet {
|
||||
public var grabberHandleHeight: CGFloat = 5.0 { didSet {
|
||||
setNeedsUpdateConstraints()
|
||||
} }
|
||||
|
||||
@@ -48,7 +48,7 @@ public class FloatingPanelSurfaceView: UIView {
|
||||
private var color: UIColor? = .white { didSet { setNeedsLayout() } }
|
||||
var bottomOverflow: CGFloat = 0.0 // Must not call setNeedsLayout()
|
||||
|
||||
@objc dynamic public override var backgroundColor: UIColor? {
|
||||
public override var backgroundColor: UIColor? {
|
||||
get { return color }
|
||||
set { color = newValue }
|
||||
}
|
||||
@@ -57,34 +57,34 @@ public class FloatingPanelSurfaceView: UIView {
|
||||
///
|
||||
/// `self.contentView` is masked with the top rounded corners automatically on iOS 11 and later.
|
||||
/// On iOS 10, they are not automatically masked because of a UIVisualEffectView issue. See https://forums.developer.apple.com/thread/50854
|
||||
@objc dynamic public var cornerRadius: CGFloat {
|
||||
public var cornerRadius: CGFloat {
|
||||
set { containerView.layer.cornerRadius = newValue; setNeedsLayout() }
|
||||
get { return containerView.layer.cornerRadius }
|
||||
}
|
||||
|
||||
/// A Boolean indicating whether the surface shadow is displayed.
|
||||
@objc dynamic public var shadowHidden: Bool = false { didSet { setNeedsLayout() } }
|
||||
public var shadowHidden: Bool = false { didSet { setNeedsLayout() } }
|
||||
|
||||
/// The color of the surface shadow.
|
||||
@objc dynamic public var shadowColor: UIColor = .black { didSet { setNeedsLayout() } }
|
||||
public var shadowColor: UIColor = .black { didSet { setNeedsLayout() } }
|
||||
|
||||
/// The offset (in points) of the surface shadow.
|
||||
@objc dynamic public var shadowOffset: CGSize = CGSize(width: 0.0, height: 1.0) { didSet { setNeedsLayout() } }
|
||||
public var shadowOffset: CGSize = CGSize(width: 0.0, height: 1.0) { didSet { setNeedsLayout() } }
|
||||
|
||||
/// The opacity of the surface shadow.
|
||||
@objc dynamic public var shadowOpacity: Float = 0.2 { didSet { setNeedsLayout() } }
|
||||
public var shadowOpacity: Float = 0.2 { didSet { setNeedsLayout() } }
|
||||
|
||||
/// The blur radius (in points) used to render the surface shadow.
|
||||
@objc dynamic public var shadowRadius: CGFloat = 3 { didSet { setNeedsLayout() } }
|
||||
public var shadowRadius: CGFloat = 3 { didSet { setNeedsLayout() } }
|
||||
|
||||
/// The width of the surface border.
|
||||
@objc dynamic public var borderColor: UIColor? { didSet { setNeedsLayout() } }
|
||||
public var borderColor: UIColor? { didSet { setNeedsLayout() } }
|
||||
|
||||
/// The color of the surface border.
|
||||
@objc dynamic public var borderWidth: CGFloat = 0.0 { didSet { setNeedsLayout() } }
|
||||
public var borderWidth: CGFloat = 0.0 { didSet { setNeedsLayout() } }
|
||||
|
||||
/// Offset of the container view from the top
|
||||
@objc dynamic public var containerTopInset: CGFloat = 0.0 { didSet {
|
||||
public var containerTopInset: CGFloat = 0.0 { didSet {
|
||||
setNeedsUpdateConstraints()
|
||||
} }
|
||||
|
||||
@@ -149,7 +149,6 @@ public class FloatingPanelSurfaceView: UIView {
|
||||
}
|
||||
|
||||
public override func updateConstraints() {
|
||||
super.updateConstraints()
|
||||
containerViewTopInsetConstraint.constant = containerTopInset
|
||||
containerViewHeightConstraint.constant = bottomOverflow
|
||||
|
||||
@@ -161,6 +160,8 @@ public class FloatingPanelSurfaceView: UIView {
|
||||
grabberHandleTopConstraint.constant = grabberTopPadding
|
||||
grabberHandleWidthConstraint.constant = grabberHandleWidth
|
||||
grabberHandleHeightConstraint.constant = grabberHandleHeight
|
||||
|
||||
super.updateConstraints()
|
||||
}
|
||||
|
||||
public override func layoutSubviews() {
|
||||
|
||||
@@ -7,9 +7,7 @@ import UIKit
|
||||
|
||||
public class GrabberHandleView: UIView {
|
||||
|
||||
@objc dynamic public var barColor = UIColor(displayP3Red: 0.76, green: 0.77, blue: 0.76, alpha: 1.0) {
|
||||
didSet { backgroundColor = barColor }
|
||||
}
|
||||
public var barColor = UIColor(displayP3Red: 0.76, green: 0.77, blue: 0.76, alpha: 1.0) { didSet { backgroundColor = barColor } }
|
||||
|
||||
required public init?(coder aDecoder: NSCoder) {
|
||||
super.init(coder: aDecoder)
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.5.1</string>
|
||||
<string>1.6.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
</dict>
|
||||
|
||||
Reference in New Issue
Block a user