This patch fixed the error at SurfaceView#L63 in Xcode 16 (#635):
> 'CALayerCornerCurve' is only available in application extensions for iOS 13.0 or newer.
use a separate `scrollLocked` var instead of abusing the scrollView's properties to store the locked state;
fixes an issue where the scroll indicators were no longer visible because lockScrollView() was executed twice before unlockScrollView() was called (due to the user changing `showsVerticalScrollIndicator` mid-animation);
The state was not changed after moving a panel without attractive
interaction. For example, a panel is moved from half to full and
the scroll content continues to scroll with its deceleration
animation. We can test it on 'Show tracking(TextView)' in Samples app.
dbef6a6 commit causes this issue.
This is because the `state` argument of `Core.isScrollable(state:)` is
not always equal to `FloatingPanelController.state` property. Therefore,
the API should pass the `state` property of `Core.isScrollable(state:)`.
On `DebugTableViewController` in the Samples app, the panel does not move
when a finger move up from the menu area to the grabber area.
`scrollViewFrame` is not necessary due to the same condition is already
checked at Core.swift:L578.
The new `floatingPanel(_:shouldAllowToScroll)` delegate method allows the
library user to determine whether the content scrolls or not in certain
state. `Core.isScrollable(state:)` and `LayoutAdpter.offset(from:)` are
added for this feature.
The error detail is here:
> Extensions.swift:11:18: error: cannot convert value of type 'CGFloat' to
> expected argument type 'Double'
>
> let v = (self * p).rounded(.towardZero) / p
> ^
> Double( )
Where a value is -0.16666666666674246, -0.0 is the rounded value to be
expected. However the current implementation returned -0.3333333333333.
This is because the floating point error. So this patch truncates it.
In Maps example, the scroll indicator of the table view doesn't show
even if `UIScrollView.showsVerticalScrollIndicator` is set to `true`.
This is due to the occurrence of two loose scroll locks before the
scroll content is displayed.
Sometimes, the content offset of the tracking scroll view would become
less than the content inset (e.g. when a panel moves from half to full
state displaying content with a top bar similar to 'Show Navigation
Controller' in the Samples app). This resulted in the content getting
fixed in an unintended position.
For this issue, this commit completely changes the scroll offset pinning
logic from one shot pinning by DispatchQueue at Core:L43-L56
That old logic was added when the UIViewPropertyAnimator was used to move
the panel. But now, the custom animator using CADisplayLink allows
fine-grained control of panel movement and then the scroll offset is
able to be pinned during its panel transitions.
Previously, the panel might not consistently keep its scroll content
offset when moving from its most expanded state to another.
Changes made in this commit:
* Keep the content offset of tracking scroll view in the following cases.
A panel is moved...
1. Outside of the tracking scroll view.
2. Inside of a navigation bar/toolbar over the tracking scroll view.
* Stopped the scroll offset reset of the `stopScrollDeceleration` flag
in the `panningEnd` method when the panel transitions from its most
expanded state because there is no issue without the reset.
These issues arose in 'Show Navigation Controller' sample of Samples app.
1. The scrollView's contentOffset always becomes (0, 0) instead of (0, -44),
which is normal if there is a UINavigationBar.
2. The scrollView's contentOffset sometimes becomes (0, 0) after moving
a panel quickly like picking.
Case 1 is caused by 7511ce5 commit.
Case 2 is caused by a workaround added at 81fd85e commit.
I tested this library from iOS 11 to iOS 16, and then I confirmed this
workaround doesn't need anymore.
Related to #602, #603.
This problem arose after 6611ec8 commit. The root cause is linked to
this condition: `0 == layoutAdapter.offsetFromMostExpandedAnchor` at
line 589 in the method `Core.shouldScrollViewHandleTouch(_:point:velocity:)`.
If the value of `layoutAdapter.offsetFromMostExpandedAnchor` has a
floating point error, the condition evaluates to false. As a result,
the panel moves even when the tracking scroll view is intended to
scroll.
This problem may not occur if there is no floating point error.
The Logging API document says that `os_log` is one of the legacy logging
symbols. However, this library needs to be supported below iOS 14 so
`log(level:_:)` cannot be used.