diff --git a/Example/ExampleTests/UIScrollViewTests.swift b/Example/ExampleTests/UIScrollViewTests.swift index 9d54e25..334b035 100644 --- a/Example/ExampleTests/UIScrollViewTests.swift +++ b/Example/ExampleTests/UIScrollViewTests.swift @@ -88,9 +88,9 @@ class UIScrollViewTests: XCTestCase { .store(in: &subscriptions) let givenVelocity: CGPoint = .init(x: 42, y: 42) - let givenTargetContentOffset: UnsafeMutablePointer = UnsafeMutablePointer .allocate(capacity: 1) + let givenTargetContentOffset: UnsafeMutablePointer = UnsafeMutablePointer.allocate(capacity: 1) - defer { givenTargetContentOffset.deallocate(capacity: 1) } + defer { givenTargetContentOffset.deallocate() } scrollView.delegate!.scrollViewWillEndDragging!(scrollView, withVelocity: givenVelocity, targetContentOffset: givenTargetContentOffset) diff --git a/Sources/CombineCocoa/Controls/UIScrollView+Combine.swift b/Sources/CombineCocoa/Controls/UIScrollView+Combine.swift index cbc923c..001398b 100644 --- a/Sources/CombineCocoa/Controls/UIScrollView+Combine.swift +++ b/Sources/CombineCocoa/Controls/UIScrollView+Combine.swift @@ -120,7 +120,7 @@ public extension UIScrollView { var willBeginZoomingPublisher: AnyPublisher { let selector = #selector(UIScrollViewDelegate.scrollViewWillBeginZooming(_:with:)) return delegateProxy.interceptSelectorPublisher(selector) - .map { $0[1] as! UIView? } + .map { $0[1] as? UIView } .eraseToAnyPublisher() } @@ -128,7 +128,7 @@ public extension UIScrollView { var didEndZooming: AnyPublisher<(view: UIView?, scale: CGFloat), Never> { let selector = #selector(UIScrollViewDelegate.scrollViewDidEndZooming(_:with:atScale:)) return delegateProxy.interceptSelectorPublisher(selector) - .map { ($0[1] as! UIView?, $0[2] as! CGFloat) } + .map { ($0[1] as? UIView, $0[2] as! CGFloat) } .eraseToAnyPublisher() }