* Support over 3 states in LayoutAdapter * Allow to inherite FloatingPanelState * Support a custome FloatingPanelState in ObjC * Replace Menu enum with UseCase enum in Samples.app * Rename UIExtensions to Extensions * Add CustomState use case in Samples app
23 lines
1.1 KiB
Swift
23 lines
1.1 KiB
Swift
// Copyright 2018-Present Shin Yamamoto. All rights reserved. MIT license.
|
|
|
|
import Foundation
|
|
import FloatingPanel
|
|
|
|
extension FloatingPanelState {
|
|
static let lastQuart: FloatingPanelState = FloatingPanelState(rawValue: "lastQuart", order: 750)
|
|
static let firstQuart: FloatingPanelState = FloatingPanelState(rawValue: "firstQuart", order: 250)
|
|
}
|
|
|
|
class FloatingPanelLayoutWithCustomState: FloatingPanelBottomLayout {
|
|
override var anchors: [FloatingPanelState: FloatingPanelLayoutAnchoring] {
|
|
return [
|
|
.full: FloatingPanelLayoutAnchor(absoluteInset: 0.0, edge: .top, referenceGuide: .safeArea),
|
|
.lastQuart: FloatingPanelLayoutAnchor(fractionalInset: 0.75, edge: .bottom, referenceGuide: .safeArea),
|
|
.half: FloatingPanelLayoutAnchor(fractionalInset: 0.5, edge: .bottom, referenceGuide: .safeArea),
|
|
.firstQuart: FloatingPanelLayoutAnchor(fractionalInset: 0.25, edge: .bottom, referenceGuide: .safeArea),
|
|
.tip: FloatingPanelLayoutAnchor(absoluteInset: 20.0, edge: .bottom, referenceGuide: .safeArea),
|
|
]
|
|
}
|
|
}
|
|
|