Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ jobs:
fail-fast: false
matrix:
include:
- os: "26.0"
xcode: "26.0.1"
sim: "iPhone 16 Pro"
parallel: NO # Stop random test job failures
runs-on: macos-15
- os: "18.5"
xcode: "16.4"
sim: "iPhone 16 Pro"
Expand Down
4 changes: 2 additions & 2 deletions Sources/Core.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Core: NSObject, UIGestureRecognizerDelegate {
}
private(set) var statePublisher: CurrentValueSubject<FloatingPanelState, Never> = .init(.hidden)

let panGestureRecognizer: FloatingPanelPanGestureRecognizer
var panGestureRecognizer: FloatingPanelPanGestureRecognizer
let panGestureDelegateRouter: FloatingPanelPanGestureRecognizer.DelegateRouter
var isRemovalInteractionEnabled: Bool = false

Expand Down Expand Up @@ -1261,7 +1261,7 @@ class Core: NSObject, UIGestureRecognizerDelegate {
}

/// A gesture recognizer that looks for panning (dragging) gestures in a panel.
public final class FloatingPanelPanGestureRecognizer: UIPanGestureRecognizer {
public class FloatingPanelPanGestureRecognizer: UIPanGestureRecognizer {
/// The gesture starting location in the surface view which it is attached to.
fileprivate var initialLocation: CGPoint = .zero
private weak var floatingPanel: Core! // Core has this gesture recognizer as non-optional
Expand Down
4 changes: 4 additions & 0 deletions Sources/SurfaceView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,13 @@ public class SurfaceAppearance: NSObject {
}
}()

#if swift(>=6.2)
@available(iOS 26.0, *)
public var cornerConfiguration: UICornerConfiguration? {
get { _cornerConfiguration as? UICornerConfiguration }
set { _cornerConfiguration = newValue }
}
#endif

private var _cornerConfiguration: Any?

Expand Down Expand Up @@ -384,11 +386,13 @@ public class SurfaceView: UIView {
}

private func updateCornerRadius() {
#if swift(>=6.2)
if #available(iOS 26.0, *), let cornerConfiguration = appearance.cornerConfiguration {
containerView.cornerConfiguration = cornerConfiguration
containerView.layer.masksToBounds = true
return
}
#endif
containerView.layer.cornerRadius = appearance.cornerRadius
guard containerView.layer.cornerRadius != 0.0 else {
containerView.layer.masksToBounds = false
Expand Down
18 changes: 18 additions & 0 deletions Tests/CoreTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -958,14 +958,30 @@ class CoreTests: XCTestCase {
}

func test_initial_scroll_offset_reset() {
class MockPanGestureRecognizer: FloatingPanelPanGestureRecognizer {
var _view: UIView?
override var view: UIView? {
set { _view = newValue }
get { _view }
}
var _state: UIGestureRecognizer.State = .possible
override var state: UIGestureRecognizer.State {
set { _state = newValue }
get { _state }
}
}
let fpc = FloatingPanelController()
let mockGesture = MockPanGestureRecognizer()
mockGesture.view = fpc.floatingPanel.surfaceView
fpc.floatingPanel.panGestureRecognizer = mockGesture
let scrollView = UIScrollView()
fpc.layout = FloatingPanelBottomLayout()
fpc.track(scrollView: scrollView)
fpc.showForTest()

fpc.move(to: .full, animated: false)


fpc.panGestureRecognizer.state = .began
fpc.floatingPanel.handle(panGesture: fpc.panGestureRecognizer)

Expand All @@ -978,6 +994,8 @@ class CoreTests: XCTestCase {

scrollView.setContentOffset(expect, animated: false)

XCTAssertEqual(expect, scrollView.contentOffset)

fpc.move(to: .half, animated: true)

waitRunLoop(secs: 1.0)
Expand Down