Closed ifarooqqdigilynx closed 1 year ago
Do you have a FloatingPanelLayout object for the top positioned panel?
If not, just try to prepare it and assigned it to fpc.layout in FloatingPanelView
.
Yes, i did the same
` import Foundation
class SKFloatingPanelLayout: FloatingPanelLayout { var positionHalf: CGFloat = 480.0 var positionFull: CGFloat = 480.0 var position: FloatingPanelPosition = .bottom var initialState: FloatingPanelState = .tip var edgePosition: FloatingPanelReferenceEdge = .bottom var showBackdrop: Bool = true var tipValue: CGFloat = -1
init(positionHalf: CGFloat, positionFull: CGFloat, position: FloatingPanelPosition, initialState: FloatingPanelState, edgePosition: FloatingPanelReferenceEdge, tipValue: CGFloat, showbakDrop: Bool) {
self.positionHalf = positionHalf
self.positionFull = positionFull
self.position = position
self.initialState = initialState
self.edgePosition = edgePosition
self.tipValue = tipValue
self.showBackdrop = showbakDrop
}
var anchors: [FloatingPanelState: FloatingPanelLayoutAnchoring] {
return [
.full: FloatingPanelLayoutAnchor(absoluteInset: positionFull, edge: edgePosition, referenceGuide: .superview),
.half: FloatingPanelLayoutAnchor(absoluteInset: positionHalf, edge: edgePosition, referenceGuide: .superview),
.tip: FloatingPanelLayoutAnchor(absoluteInset: tipValue, edge: edgePosition, referenceGuide: .superview),
// .hidden: FloatingPanelLayoutAnchor(absoluteInset: 0, edge: edgePosition, referenceGuide: .superview),
]
}
func backdropAlpha(for state: FloatingPanelState) -> CGFloat {
print("ALERT \(state)")
if state == .tip || !showBackdrop {
return 0.0
}
return 0.04
}
} `
`func floatingPanel(_ fpc: FloatingPanelController, layoutFor newCollection: UITraitCollection) -> FloatingPanelLayout { switch postionFPC { case let .top(pHalf, pFull): return SKFloatingPanelLayout(positionHalf: CGFloat(pHalf), positionFull: CGFloat(pFull), position: .top, initialState: .tip, edgePosition: .top, tipValue: 0, showbakDrop: showBackdrop) case let .bottomMapUsers(pHalf, pFull): return SKFloatingPanelLayout(positionHalf: CGFloat(pHalf), positionFull: CGFloat(pFull), position: .bottom, initialState: .tip, edgePosition: .bottom, tipValue: 166, showbakDrop: showBackdrop)
case let .bottomFilter(pHalf, pFull):
return SKFloatingPanelLayout(positionHalf: CGFloat(pHalf), positionFull: CGFloat(pFull), position: .bottom, initialState: .tip, edgePosition: .bottom, tipValue: 0, showbakDrop: showBackdrop)
}
}`
Thankyou i had to replace sample code, now its working.
Can you please guide how can i invalidatelayout with animation?
withAnimation(.hero) { proxy.fpc?.invalidateLayout() }
above code is not animating.
Can you please guide how can i invalidatelayout with animation?
invalidateLayout()
api can be use with UIKit animation. So please use UIView.animate
API.
Thankyou i had to replace sample code, now its working.
Sounds good! I'll close this issue. Thank you.
Description
Using SwiftUI i created floating panels for both bottom and top but Grabber Handle is showing above the content for Top Positioned Floating Panels.
Expected behavior
Garbber Handle should stick to bottom area of panel
Actual behaviour
Grabber Handle is showing above the content
Steps to reproduce
Code example that reproduces the issue
How do you display panel(s)?
How many panels do you displays? I have 3 panels attached to SwiftUI View
Environment
Xcode 14.0+
Library version Latest by today
Installation method
iOS version(s) iOS 14.0+
Xcode version Xcode 14.2