Compare commits

..

10 Commits

Author SHA1 Message Date
Shin Yamamoto ca7596e1ca Version 1.7.6 2020-09-19 11:09:30 +09:00
Shin Yamamoto 007f9af3eb Enable the removal interaction at any positions upon the conditions (#335)
If a library consumer allows a panel projectable movement with the
FloatingPanelBehavior object, the panel is able to invoke the removal
interaction when the next moving position projected the momentum is
hidden.
2020-09-03 23:07:33 +09:00
Michal Raška da4e1d26d3 Fix quick pull down (#385) 2020-09-03 21:41:16 +09:00
Shin Yamamoto 2ce1375ce7 Fix an issue where keyboard opens above image picker (#381)
This issue was reported in
https://github.com/SCENEE/FloatingPanel/issues/369.

The cause of that is the containerViewWillLayoutSubviews() of
FloatingPanelPresentationController is called in presenting a
UIImagePickerViewController. As a result, a FloatingPanelController
view is added unnecessarily.

I don't know the reason why the method is called, but this patch
resolves the issue.

By the way, the issue doesn't happen when a FloatingPanelController
shows as a child view controller
2020-09-03 20:42:21 +09:00
Greg Hazel 28c384aa0d use 'prominent' blur effect (#379)
'prominent' blue effect is adaptive to dark mode.
2020-08-10 12:36:47 +09:00
Christopher Truman 9c71a47d9b Small typo fixes (#378) 2020-08-10 09:55:10 +09:00
Leko Murphy 8903e4e610 don't remove panel on view disappearance (#367) 2020-07-11 09:46:41 +09:00
Shin Yamamoto 5634de2eee Merge pull request #371 from knchst/modify/readme
Modify README.md sample code.
2020-07-11 09:42:16 +09:00
Kenichi Saito 1957ae3919 Modify README 2020-07-09 19:59:20 +09:00
Shin Yamamoto a4f8c0528c Merge pull request #356 from SCENEE/release-1.7.5
Release 1.7.5
2020-06-04 08:30:31 +09:00
8 changed files with 43 additions and 24 deletions
@@ -27,7 +27,7 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
</view>
<blurEffect style="light"/>
<blurEffect style="prominent"/>
</visualEffectView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@@ -232,7 +232,7 @@
<constraint firstItem="Zcj-SE-gb8" firstAttribute="leading" secondItem="ED1-gT-FBj" secondAttribute="leading" id="wMb-L2-Z0W"/>
</constraints>
</view>
<blurEffect style="extraLight"/>
<blurEffect style="prominent"/>
</visualEffectView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+12 -1
View File
@@ -1355,15 +1355,26 @@ final class MultiPanelController: FloatingPanelController, FloatingPanelControll
private final class FirstViewLayout: FloatingPanelLayout {
let initialPosition: FloatingPanelPosition = .full
let supportedPositions: Set<FloatingPanelPosition> = [.full]
let supportedPositions: Set<FloatingPanelPosition> = [.full, .half]
func insetFor(position: FloatingPanelPosition) -> CGFloat? {
switch position {
case .full: return 40.0
case .half: return 200.0
default: return nil
}
}
}
private final class FirstViewBehavior: FloatingPanelBehavior {
func shouldProjectMomentum(_ fpc: FloatingPanelController, for proposedTargetPosition: FloatingPanelPosition) -> Bool {
return true
}
}
func floatingPanel(_ vc: FloatingPanelController, behaviorFor newCollection: UITraitCollection) -> FloatingPanelBehavior? {
return FirstViewBehavior()
}
func floatingPanel(_ vc: FloatingPanelController, layoutFor newCollection: UITraitCollection) -> FloatingPanelLayout? {
return FirstViewLayout()
}
+1 -1
View File
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = "FloatingPanel"
s.version = "1.7.5"
s.version = "1.7.6"
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.
+15 -7
View File
@@ -617,16 +617,24 @@ class FloatingPanelCore: NSObject, UIGestureRecognizerDelegate {
endInteraction(for: targetPosition)
if isRemovalInteractionEnabled, isBottomState {
let velocityVector = (distance != 0) ? CGVector(dx: 0, dy: min(velocity.y/distance, behavior.removalVelocity)) : .zero
if isRemovalInteractionEnabled {
let velocityVector: CGVector
if distance == 0 {
velocityVector = .zero
} else {
let dy = min(velocity.y / abs(distance), behavior.removalVelocity)
velocityVector = CGVector(dx: 0, dy: dy)
}
// `velocityVector` will be replaced by just a velocity(not vector) when FloatingPanelRemovalInteraction will be added.
if shouldStartRemovalAnimation(with: velocityVector), let vc = viewcontroller {
vc.delegate?.floatingPanelDidEndDraggingToRemove(vc, withVelocity: velocity)
let animationVector = CGVector(dx: abs(velocityVector.dx), dy: abs(velocityVector.dy))
startRemovalAnimation(vc, with: animationVector) { [weak self] in
self?.finishRemovalAnimation()
if behavior.shouldProjectMomentum(vc, for: targetPosition) || isBottomState {
vc.delegate?.floatingPanelDidEndDraggingToRemove(vc, withVelocity: velocity)
let animationVector = CGVector(dx: abs(velocityVector.dx), dy: abs(velocityVector.dy))
startRemovalAnimation(vc, with: animationVector) { [weak self] in
self?.finishRemovalAnimation()
}
return
}
return
}
}
+2 -2
View File
@@ -402,8 +402,8 @@ class FloatingPanelLayoutAdapter {
// unsatisfiable constraints
if self.interactiveTopConstraint == nil {
// Actiavate `interactiveTopConstraint` for `fitToBounds` mode.
// It goes throught this path when the pan gesture state jumps
// Activate `interactiveTopConstraint` for `fitToBounds` mode.
// It goes through this path when the pan gesture state jumps
// from .begin to .end.
startInteraction(at: state)
}
@@ -47,8 +47,15 @@ class FloatingPanelPresentationController: UIPresentationController {
override func containerViewWillLayoutSubviews() {
guard
let fpc = presentedViewController as? FloatingPanelController
else { fatalError() }
let fpc = presentedViewController as? FloatingPanelController,
/**
This condition fixes https://github.com/SCENEE/FloatingPanel/issues/369.
The issue is that this method is called in presenting a
UIImagePickerViewController and then a FloatingPanelController
view is added unnecessarily.
*/
fpc.presentedViewController == nil
else { return }
/*
* Layout the views managed by `FloatingPanelController` here for the
+1 -1
View File
@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.7.5</string>
<string>1.7.6</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
</dict>
+1 -8
View File
@@ -138,13 +138,6 @@ class ViewController: UIViewController, FloatingPanelControllerDelegate {
// Add and show the views managed by the `FloatingPanelController` object to self.view.
fpc.addPanel(toParent: self)
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
// Remove the views managed by the `FloatingPanelController` object from self.view.
fpc.removePanelFromParent()
}
}
```
@@ -447,7 +440,7 @@ The feature can be used for these 2 kind panels
You can disable the pan gesture recognizer directly
```swift
fpc.panGestureRecognizer.isEnable = false
fpc.panGestureRecognizer.isEnabled = false
```
Or use this `FloatingPanelControllerDelegate` method.