diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8153d5bc..3eda5045 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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" diff --git a/Sources/Core.swift b/Sources/Core.swift index ee8de673..2d19ac79 100644 --- a/Sources/Core.swift +++ b/Sources/Core.swift @@ -52,7 +52,7 @@ class Core: NSObject, UIGestureRecognizerDelegate { } private(set) var statePublisher: CurrentValueSubject = .init(.hidden) - let panGestureRecognizer: FloatingPanelPanGestureRecognizer + var panGestureRecognizer: FloatingPanelPanGestureRecognizer let panGestureDelegateRouter: FloatingPanelPanGestureRecognizer.DelegateRouter var isRemovalInteractionEnabled: Bool = false @@ -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 diff --git a/Sources/SurfaceView.swift b/Sources/SurfaceView.swift index 40589815..1c02ab90 100644 --- a/Sources/SurfaceView.swift +++ b/Sources/SurfaceView.swift @@ -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? @@ -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 diff --git a/Tests/CoreTests.swift b/Tests/CoreTests.swift index 9ff25247..9dfda5e3 100644 --- a/Tests/CoreTests.swift +++ b/Tests/CoreTests.swift @@ -958,7 +958,22 @@ 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) @@ -966,6 +981,7 @@ class CoreTests: XCTestCase { fpc.move(to: .full, animated: false) + fpc.panGestureRecognizer.state = .began fpc.floatingPanel.handle(panGesture: fpc.panGestureRecognizer) @@ -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)