├── .github ├── FUNDING.yml └── workflows │ └── ci.yml ├── .gitignore ├── ScrollViewPlus ├── UnconstrainedClipView.swift ├── ScrollViewPlus.xcconfig ├── ScrollViewPlus.h ├── NSScroller+Thickness.swift ├── Info.plist ├── OverlayOnlyScrollView.swift ├── ObservableScroller.swift ├── ScrollViewVisibleRectObserver.swift ├── PositionJumpingWorkaroundScrollView.swift └── ScrollerOverlayObserver.swift ├── .editorconfig ├── ScrollViewPlus.xcodeproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── xcshareddata │ └── xcschemes │ │ └── ScrollViewPlus.xcscheme └── project.pbxproj ├── ScrollViewPlusTests ├── OverlayOnlyScrollViewTests.swift └── Info.plist ├── Package.swift ├── LICENSE ├── README.md └── CODE_OF_CONDUCT.md /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [mattmassicotte] 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | xcuserdata/ 5 | DerivedData/ 6 | /Carthage 7 | .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata 8 | -------------------------------------------------------------------------------- /ScrollViewPlus/UnconstrainedClipView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // File.swift 3 | // 4 | // 5 | // Created by Matthew Massicotte on 2022-07-18. 6 | // 7 | 8 | import Foundation 9 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = tab 5 | indent_size = 4 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | -------------------------------------------------------------------------------- /ScrollViewPlus.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ScrollViewPlus.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ScrollViewPlus/ScrollViewPlus.xcconfig: -------------------------------------------------------------------------------- 1 | // Configuration settings file format documentation can be found at: 2 | // https://help.apple.com/xcode/#/dev745c5c974 3 | 4 | SWIFT_VERSION = 5.0 5 | MACH_O_TYPE = staticlib 6 | 7 | CURRENT_PROJECT_VERSION = 2 8 | DYLIB_CURRENT_VERSION = $(CURRENT_PROJECT_VERSION) 9 | MARKETING_VERSION = 0.1.1 10 | 11 | MACOSX_DEPLOYMENT_TARGET = 10.12 12 | -------------------------------------------------------------------------------- /ScrollViewPlusTests/OverlayOnlyScrollViewTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | @testable import ScrollViewPlus 3 | 4 | final class OverlayOnlyScrollViewTests: XCTestCase { 5 | @MainActor 6 | func testBasicInitialization() { 7 | let scrollView = OverlayOnlyScrollView() 8 | 9 | XCTAssertEqual(scrollView.scrollerStyle, .overlay) 10 | 11 | scrollView.scrollerStyle = .legacy 12 | 13 | XCTAssertEqual(scrollView.scrollerStyle, .overlay) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version: 6.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "ScrollViewPlus", 7 | platforms: [ 8 | .macOS(.v10_13) 9 | ], 10 | products: [ 11 | .library(name: "ScrollViewPlus", targets: ["ScrollViewPlus"]), 12 | ], 13 | dependencies: [], 14 | targets: [ 15 | .target(name: "ScrollViewPlus", dependencies: [], path: "ScrollViewPlus/"), 16 | .testTarget(name: "ScrollViewPlusTests", dependencies: ["ScrollViewPlus"], path: "ScrollViewPlusTests/"), 17 | ] 18 | ) 19 | -------------------------------------------------------------------------------- /ScrollViewPlus/ScrollViewPlus.h: -------------------------------------------------------------------------------- 1 | // 2 | // ScrollViewPlus.h 3 | // ScrollViewPlus 4 | // 5 | // Created by Matthew Massicotte on 2021-06-24. 6 | // 7 | 8 | #import 9 | 10 | //! Project version number for ScrollViewPlus. 11 | FOUNDATION_EXPORT double ScrollViewPlusVersionNumber; 12 | 13 | //! Project version string for ScrollViewPlus. 14 | FOUNDATION_EXPORT const unsigned char ScrollViewPlusVersionString[]; 15 | 16 | // In this header, you should import all the public headers of your framework using statements like #import 17 | 18 | 19 | -------------------------------------------------------------------------------- /ScrollViewPlus/NSScroller+Thickness.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | 3 | public extension NSScroller { 4 | var knobSlotThickness: CGFloat { 5 | let thicknessRect = rect(for: .knobSlot) 6 | 7 | return min(thicknessRect.width, thicknessRect.height) 8 | } 9 | 10 | var knobThickness: CGFloat { 11 | let thicknessRect = rect(for: .knob) 12 | 13 | return min(thicknessRect.width, thicknessRect.height) 14 | } 15 | 16 | var defaultKnobSlotThickness: CGFloat { 17 | return NSScroller.scrollerWidth(for: controlSize, scrollerStyle: scrollerStyle) 18 | } 19 | 20 | var knobSlotVisible: Bool { 21 | return knobSlotThickness >= defaultKnobSlotThickness 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | paths-ignore: 8 | - 'README.md' 9 | - 'CODE_OF_CONDUCT.md' 10 | - '.editorconfig' 11 | - '.spi.yml' 12 | pull_request: 13 | branches: 14 | - main 15 | 16 | concurrency: 17 | group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} 18 | cancel-in-progress: true 19 | 20 | jobs: 21 | test: 22 | name: Test 23 | runs-on: macOS-15 24 | timeout-minutes: 30 25 | env: 26 | DEVELOPER_DIR: /Applications/Xcode_16.3.app 27 | steps: 28 | - uses: actions/checkout@v4 29 | - name: Test platform ${{ matrix.destination }} 30 | run: set -o pipefail && xcodebuild -scheme ScrollViewPlus -destination "platform=macOS" test | xcbeautify 31 | -------------------------------------------------------------------------------- /ScrollViewPlusTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /ScrollViewPlus/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | 22 | 23 | -------------------------------------------------------------------------------- /ScrollViewPlus/OverlayOnlyScrollView.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | 3 | /// An `NSScrollView` subclass that only uses overlay-style scrollers. 4 | @MainActor 5 | open class OverlayOnlyScrollView: NSScrollView { 6 | public override init(frame frameRect: NSRect) { 7 | super.init(frame: frameRect) 8 | 9 | super.scrollerStyle = .overlay 10 | } 11 | 12 | public required init?(coder: NSCoder) { 13 | super.init(coder: coder) 14 | 15 | super.scrollerStyle = .overlay 16 | } 17 | 18 | public override var scrollerStyle: NSScroller.Style { 19 | get { 20 | return super.scrollerStyle 21 | } 22 | set { 23 | // AppKit will set this value in a number of places automatically, so the 24 | // safest bet is to prevent any from taking place 25 | _ = newValue 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ScrollViewPlus/ObservableScroller.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | 3 | public extension Notification.Name { 4 | static let thicknessDidChange = Notification.Name("ScrollerThicknessDidChange") 5 | static let willStartTracking = Notification.Name("ScrollerWillStartTracking") 6 | static let didEndTracking = Notification.Name("ScrollerDidEndTracking") 7 | } 8 | 9 | @MainActor 10 | open class ObservableScroller: NSScroller { 11 | private var lastSlotThickness: CGFloat = 0.0 12 | 13 | override open class var isCompatibleWithOverlayScrollers: Bool { 14 | return self == ObservableScroller.self 15 | } 16 | 17 | private func checkThickness() { 18 | let currentThickness = knobSlotThickness 19 | 20 | if currentThickness != lastSlotThickness { 21 | NotificationCenter.default.post(name: .thicknessDidChange, object: self) 22 | } 23 | 24 | lastSlotThickness = currentThickness 25 | } 26 | 27 | override open func setNeedsDisplay(_ invalidRect: NSRect) { 28 | checkThickness() 29 | 30 | super.setNeedsDisplay(invalidRect) 31 | } 32 | 33 | override open func trackKnob(with event: NSEvent) { 34 | checkThickness() 35 | NotificationCenter.default.post(name: .willStartTracking, object: self) 36 | 37 | super.trackKnob(with: event) 38 | 39 | checkThickness() 40 | NotificationCenter.default.post(name: .didEndTracking, object: self) 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2021, Chime 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /ScrollViewPlus/ScrollViewVisibleRectObserver.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | 3 | /// Used to observe changes to the scroll view's visible contents. 4 | @MainActor 5 | public final class ScrollViewVisibleRectObserver { 6 | public typealias ObservationHandler = (NSScrollView) -> Void 7 | 8 | public let scrollView: NSScrollView 9 | public var frameChangedHandler: ObservationHandler? 10 | public var contentBoundsChangedHandler: ObservationHandler? 11 | 12 | public init(scrollView: NSScrollView) { 13 | self.scrollView = scrollView 14 | 15 | NotificationCenter.default.addObserver(self, 16 | selector: #selector(frameDidChange(_:)), 17 | name: NSView.frameDidChangeNotification, 18 | object: scrollView) 19 | 20 | NotificationCenter.default.addObserver(self, 21 | selector: #selector(contentBoundsDidChange(_:)), 22 | name: NSView.boundsDidChangeNotification, 23 | object: scrollView.contentView) 24 | } 25 | 26 | deinit { 27 | NotificationCenter.default.removeObserver(self) 28 | } 29 | 30 | @objc private func frameDidChange(_ notification: Notification) { 31 | frameChangedHandler?(scrollView) 32 | } 33 | 34 | @objc private func contentBoundsDidChange(_ notification: Notification) { 35 | contentBoundsChangedHandler?(scrollView) 36 | } 37 | 38 | public func withViewFrameChangeNotificationsDisabled(_ withDisabledBlock: () -> Void) { 39 | scrollView.postsFrameChangedNotifications = false 40 | scrollView.contentView.postsBoundsChangedNotifications = false 41 | 42 | withDisabledBlock() 43 | 44 | scrollView.postsFrameChangedNotifications = true 45 | scrollView.contentView.postsBoundsChangedNotifications = true 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /ScrollViewPlus.xcodeproj/xcshareddata/xcschemes/ScrollViewPlus.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 53 | 54 | 60 | 61 | 67 | 68 | 69 | 70 | 72 | 73 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | [![Build Status][build status badge]][build status] 4 | [![Platforms][platforms badge]][platforms] 5 | [![Matrix][matrix badge]][matrix] 6 | 7 |
8 | 9 | # ScrollViewPlus 10 | 11 | ScrollViewPlus is a small library that provides some helpful extension and capabilities for working with `NSScrollView`. 12 | 13 | ## Integration 14 | 15 | ### Swift Package Manager 16 | 17 | ```swift 18 | dependencies: [ 19 | .package(url: "https://github.com/ChimeHQ/ScrollViewPlus.git") 20 | ] 21 | ``` 22 | 23 | ## Classes 24 | 25 | ### ScrollViewVisibleRectObserver 26 | 27 | Simple class to monitor the user-visible portion of an `NSScrollView` document view. 28 | 29 | ### ObservableScroller 30 | 31 | An `NSScroller` subclass that makes it possible to determine the overlay style's slot thickness and detect changes to it. 32 | 33 | ### ScrollerOverlayObserver 34 | 35 | A class that can be used to observe the scroller overlay size and visibily changes. This makes use of some heuristics that aren't perfect, but the end result is quite good. Must be used in combination with `ObservableScroller`, but does not enforce an `NSScrollView` subclass requirement. 36 | 37 | ### OverlayOnlyScrollView 38 | 39 | A very simple `NSScrollView` subclass that will always use overlay style scrollers, regardless of user prefs or input device types. 40 | 41 | ### PositionJumpingWorkaroundScrollView 42 | 43 | A class that works around a pretty esoteric problem: 44 | 45 | The scroll-position jumping will occur if this view contains an `NSTextView` and: 46 | 47 | - non-contiguous layout enabled for the `NSTextView`'s `NSLayoutManager` 48 | - there are actual non contiguous blocks in the layout 49 | - the `NSTextView` is configured so text does not wrap to the view's bounds 50 | - there are at least some lines of text that are actually larger than the view's bounds 51 | - the containing `NSScrollView` has a vertical ruler present 52 | - the pointing device is a trackpad 53 | 54 | ## Contributing and Collaboration 55 | 56 | I would love to hear from you! Issues or pull requests work great. Both a [Matrix space][matrix] and [Discord][discord] are available for live help, but I have a strong bias towards answering in the form of documentation. You can also find me on [the web](https://www.massicotte.org). 57 | 58 | I prefer collaboration, and would love to find ways to work together if you have a similar project. 59 | 60 | I prefer indentation with tabs for improved accessibility. But, I'd rather you use the system you want and make a PR than hesitate because of whitespace. 61 | 62 | By participating in this project you agree to abide by the [Contributor Code of Conduct](CODE_OF_CONDUCT.md). 63 | 64 | [build status]: https://github.com/ChimeHQ/ScrollViewPlus/actions 65 | [build status badge]: https://github.com/ChimeHQ/ScrollViewPlus/workflows/CI/badge.svg 66 | [platforms]: https://swiftpackageindex.com/ChimeHQ/ScrollViewPlus 67 | [platforms badge]: https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FChimeHQ%2FScrollViewPlus%2Fbadge%3Ftype%3Dplatforms 68 | [matrix]: https://matrix.to/#/%23chimehq%3Amatrix.org 69 | [matrix badge]: https://img.shields.io/matrix/chimehq%3Amatrix.org?label=Matrix 70 | [discord]: https://discord.gg/esFpX6sErJ 71 | -------------------------------------------------------------------------------- /ScrollViewPlus/PositionJumpingWorkaroundScrollView.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | 3 | /// Works around a bug in macOS that can cause terrible scroll-position jumping with `NSTextView`. 4 | /// 5 | /// The scroll-position jumping will occur if this view contains an `NSTextView` and: 6 | /// 7 | /// - non-contiguous layout enabled for the `NSTextView`'s NSLayoutManager 8 | /// - there are actual non contiguous blocks in the layout 9 | /// - the `NSTextView` is configured so text does not wrap to the view's bounds 10 | /// - there are at least some lines of text that are actually larger than the view's bounds 11 | /// - the containing `NSScrollView` has a vertical ruler present 12 | /// - the pointing device is a trackpad 13 | /// 14 | /// This class uses a workaround only while these conditions are met, with the exception 15 | /// of the scroll being initiated by a trackpad. Haven't yet figured out how to detect that 16 | /// situation. 17 | @MainActor 18 | open class PositionJumpingWorkaroundScrollView: NSScrollView { 19 | private var lastPosition: CGFloat = 0.0 20 | 21 | private var textView: NSTextView? { 22 | return documentView as? NSTextView 23 | } 24 | 25 | private var hasUnlaidText: Bool { 26 | guard 27 | let firstUnlaidIndex = textView?.layoutManager?.firstUnlaidCharacterIndex(), 28 | let textLength = textView?.textStorage?.length 29 | else { 30 | return false 31 | } 32 | 33 | return firstUnlaidIndex < textLength 34 | } 35 | 36 | private var workaroundChecksNeeded: Bool { 37 | guard rulersVisible else { 38 | return false 39 | } 40 | 41 | guard hasVerticalRuler else { 42 | return false 43 | } 44 | 45 | guard hasUnlaidText else { 46 | return false 47 | } 48 | 49 | return true 50 | } 51 | 52 | private var textPadding: CGFloat { 53 | let padding = textView?.textContainer?.lineFragmentPadding ?? 0.0 54 | let inset = textView?.textContainerInset.width ?? 0.0 55 | 56 | return padding + inset 57 | } 58 | 59 | private var documentOrigin: CGPoint { 60 | return contentView.documentRect.origin 61 | } 62 | 63 | private var rulerSideTripLength: CGFloat { 64 | let thickness = verticalRulerView?.requiredThickness ?? 0.0 65 | 66 | return thickness - textPadding - documentOrigin.x 67 | } 68 | 69 | private func shouldFilterScrollPoint(_ newPoint: NSPoint) -> Bool { 70 | guard workaroundChecksNeeded else { 71 | return false 72 | } 73 | 74 | let newPos = newPoint.x 75 | let lastPos = lastPosition 76 | 77 | // Case 1: jump that occurs when leading text is obsecured by the ruler 78 | // 79 | // this is -1.0 to give a little slack so that the scroll appears smoother 80 | if lastPos < -1.0 && newPos == documentOrigin.x { 81 | return true 82 | } 83 | 84 | // Case 2: jump that occurs when leading text is obsecured by the ruler 85 | // and also scrolled far enough to cause elastic behavior 86 | if lastPos < -rulerSideTripLength && newPos == -rulerSideTripLength { 87 | return true 88 | } 89 | 90 | return false 91 | } 92 | 93 | public override func scroll(_ clipView: NSClipView, to point: NSPoint) { 94 | if shouldFilterScrollPoint(point) { 95 | let filteredPoint = NSPoint(x: lastPosition, y: point.y) 96 | 97 | super.scroll(clipView, to: filteredPoint) 98 | 99 | return 100 | } 101 | 102 | lastPosition = point.x 103 | 104 | super.scroll(clipView, to: point) 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | 2 | # Contributor Covenant Code of Conduct 3 | 4 | ## Our Pledge 5 | 6 | We as members, contributors, and leaders pledge to make participation in our 7 | community a harassment-free experience for everyone, regardless of age, body 8 | size, visible or invisible disability, ethnicity, sex characteristics, gender 9 | identity and expression, level of experience, education, socio-economic status, 10 | nationality, personal appearance, race, caste, color, religion, or sexual 11 | identity and orientation. 12 | 13 | We pledge to act and interact in ways that contribute to an open, welcoming, 14 | diverse, inclusive, and healthy community. 15 | 16 | ## Our Standards 17 | 18 | Examples of behavior that contributes to a positive environment for our 19 | community include: 20 | 21 | * Demonstrating empathy and kindness toward other people 22 | * Being respectful of differing opinions, viewpoints, and experiences 23 | * Giving and gracefully accepting constructive feedback 24 | * Accepting responsibility and apologizing to those affected by our mistakes, 25 | and learning from the experience 26 | * Focusing on what is best not just for us as individuals, but for the overall 27 | community 28 | 29 | Examples of unacceptable behavior include: 30 | 31 | * The use of sexualized language or imagery, and sexual attention or advances of 32 | any kind 33 | * Trolling, insulting or derogatory comments, and personal or political attacks 34 | * Public or private harassment 35 | * Publishing others' private information, such as a physical or email address, 36 | without their explicit permission 37 | * Other conduct which could reasonably be considered inappropriate in a 38 | professional setting 39 | 40 | ## Enforcement Responsibilities 41 | 42 | Community leaders are responsible for clarifying and enforcing our standards of 43 | acceptable behavior and will take appropriate and fair corrective action in 44 | response to any behavior that they deem inappropriate, threatening, offensive, 45 | or harmful. 46 | 47 | Community leaders have the right and responsibility to remove, edit, or reject 48 | comments, commits, code, wiki edits, issues, and other contributions that are 49 | not aligned to this Code of Conduct, and will communicate reasons for moderation 50 | decisions when appropriate. 51 | 52 | ## Scope 53 | 54 | This Code of Conduct applies within all community spaces, and also applies when 55 | an individual is officially representing the community in public spaces. 56 | Examples of representing our community include using an official e-mail address, 57 | posting via an official social media account, or acting as an appointed 58 | representative at an online or offline event. 59 | 60 | ## Enforcement 61 | 62 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 63 | reported to the community leaders responsible for enforcement at 64 | support@chimehq.com. 65 | All complaints will be reviewed and investigated promptly and fairly. 66 | 67 | All community leaders are obligated to respect the privacy and security of the 68 | reporter of any incident. 69 | 70 | ## Enforcement Guidelines 71 | 72 | Community leaders will follow these Community Impact Guidelines in determining 73 | the consequences for any action they deem in violation of this Code of Conduct: 74 | 75 | ### 1. Correction 76 | 77 | **Community Impact**: Use of inappropriate language or other behavior deemed 78 | unprofessional or unwelcome in the community. 79 | 80 | **Consequence**: A private, written warning from community leaders, providing 81 | clarity around the nature of the violation and an explanation of why the 82 | behavior was inappropriate. A public apology may be requested. 83 | 84 | ### 2. Warning 85 | 86 | **Community Impact**: A violation through a single incident or series of 87 | actions. 88 | 89 | **Consequence**: A warning with consequences for continued behavior. No 90 | interaction with the people involved, including unsolicited interaction with 91 | those enforcing the Code of Conduct, for a specified period of time. This 92 | includes avoiding interactions in community spaces as well as external channels 93 | like social media. Violating these terms may lead to a temporary or permanent 94 | ban. 95 | 96 | ### 3. Temporary Ban 97 | 98 | **Community Impact**: A serious violation of community standards, including 99 | sustained inappropriate behavior. 100 | 101 | **Consequence**: A temporary ban from any sort of interaction or public 102 | communication with the community for a specified period of time. No public or 103 | private interaction with the people involved, including unsolicited interaction 104 | with those enforcing the Code of Conduct, is allowed during this period. 105 | Violating these terms may lead to a permanent ban. 106 | 107 | ### 4. Permanent Ban 108 | 109 | **Community Impact**: Demonstrating a pattern of violation of community 110 | standards, including sustained inappropriate behavior, harassment of an 111 | individual, or aggression toward or disparagement of classes of individuals. 112 | 113 | **Consequence**: A permanent ban from any sort of public interaction within the 114 | community. 115 | 116 | ## Attribution 117 | 118 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 119 | version 2.1, available at 120 | [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. 121 | 122 | Community Impact Guidelines were inspired by 123 | [Mozilla's code of conduct enforcement ladder][Mozilla CoC]. 124 | 125 | For answers to common questions about this code of conduct, see the FAQ at 126 | [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at 127 | [https://www.contributor-covenant.org/translations][translations]. 128 | 129 | [homepage]: https://www.contributor-covenant.org 130 | [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html 131 | [Mozilla CoC]: https://github.com/mozilla/diversity 132 | [FAQ]: https://www.contributor-covenant.org/faq 133 | [translations]: https://www.contributor-covenant.org/translations 134 | -------------------------------------------------------------------------------- /ScrollViewPlus/ScrollerOverlayObserver.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | 3 | /// Observes the state of overlay-style NSScrollers. 4 | /// 5 | /// This class monitors the state of overlay-style NSScrollers. It can invoke callbacks when 6 | /// interesting events occur, like visibility and thickness changes. 7 | /// 8 | /// Because AppKit does not provide sufficient hooks for these events, in some cases 9 | /// `ScrollerOverlayObserver` depends on heuristics that aren't always correct in all situations 10 | /// across all OS releases. 11 | @MainActor 12 | public final class ScrollerOverlayObserver: NSObject { 13 | private enum TrackingState: Hashable { 14 | case idle 15 | case visible(Date, TimeInterval) 16 | case tracking 17 | 18 | mutating func handleVisbilityEvent(with interval: TimeInterval) -> Bool { 19 | switch self { 20 | case .idle: 21 | self = .visible(Date(), interval) 22 | return true 23 | case .visible: 24 | self = .visible(Date(), interval) 25 | case .tracking: 26 | break 27 | } 28 | 29 | return false 30 | } 31 | 32 | var invisible: Bool { 33 | switch self { 34 | case .idle: 35 | return true 36 | default: 37 | return false 38 | } 39 | } 40 | 41 | mutating func handleVisibilityCheck(with date: Date) -> TimeInterval? { 42 | switch self { 43 | case .idle: 44 | return nil 45 | case .tracking: 46 | return nil 47 | case .visible(let startDate, let interval): 48 | let elasped = date.timeIntervalSince(startDate) 49 | 50 | if elasped >= interval { 51 | self = .idle 52 | return nil 53 | } 54 | 55 | return interval - elasped 56 | } 57 | } 58 | } 59 | 60 | private weak var scrollView: NSScrollView? 61 | private var horizontalState: TrackingState 62 | private var verticalState: TrackingState 63 | private var lastPoint: CGPoint 64 | public var visibilityChangedHandler: (() -> Void)? 65 | public var scrollerThicknessChangedHandler: (() -> Void)? 66 | 67 | public init(scrollView: NSScrollView) { 68 | self.scrollView = scrollView 69 | self.horizontalState = .idle 70 | self.verticalState = .idle 71 | self.lastPoint = .zero 72 | 73 | super.init() 74 | 75 | NotificationCenter.default.addObserver(self, selector: #selector(scrollerWillStartTracking(_:)), name: .willStartTracking, object: nil) 76 | NotificationCenter.default.addObserver(self, selector: #selector(scrollerDidEndTracking(_:)), name: .didEndTracking, object: nil) 77 | NotificationCenter.default.addObserver(self, selector: #selector(scrollerThicknessDidChange(_:)), name: .thicknessDidChange, object: nil) 78 | } 79 | 80 | var horizontalScroller: NSScroller? { 81 | return scrollView?.horizontalScroller 82 | } 83 | 84 | var verticalScroller: NSScroller? { 85 | return scrollView?.verticalScroller 86 | } 87 | 88 | public var horizontalScrollerVisible: Bool { 89 | return horizontalState.invisible == false 90 | } 91 | 92 | public var verticalScrollerVisible: Bool { 93 | return verticalState.invisible == false 94 | } 95 | 96 | private func postScrollerVisibilityChanged() { 97 | visibilityChangedHandler?() 98 | } 99 | 100 | @objc private func scrollerWillStartTracking(_ notification: Notification) { 101 | guard let obj = notification.object as? NSScroller else { return } 102 | 103 | var postNotification = false 104 | 105 | if let scroller = horizontalScroller, scroller == obj { 106 | if horizontalState.invisible { 107 | postNotification = true 108 | } 109 | 110 | self.horizontalState = .tracking 111 | } 112 | 113 | if let scroller = verticalScroller, scroller == obj { 114 | if verticalState.invisible { 115 | postNotification = true 116 | } 117 | 118 | self.verticalState = .tracking 119 | } 120 | 121 | guard postNotification else { return } 122 | 123 | postScrollerVisibilityChanged() 124 | } 125 | 126 | @objc private func scrollerDidEndTracking(_ notification: Notification) { 127 | guard let obj = notification.object as? NSScroller else { return } 128 | 129 | var affected = false 130 | let interval = trackingVisibilityTimeInterval 131 | 132 | if let scroller = horizontalScroller, scroller == obj { 133 | self.horizontalState = .visible(Date(), interval) 134 | affected = true 135 | } 136 | 137 | if let scroller = verticalScroller, scroller == obj { 138 | self.verticalState = .visible(Date(), interval) 139 | affected = true 140 | } 141 | 142 | guard affected else { return } 143 | 144 | scheduleCheck(for: interval) 145 | } 146 | 147 | @objc private func scrollerThicknessDidChange(_ notification: Notification) { 148 | guard let obj = notification.object as? NSScroller else { return } 149 | 150 | var affected = false 151 | 152 | if let scroller = horizontalScroller, scroller == obj { 153 | affected = true 154 | } 155 | 156 | if let scroller = verticalScroller, scroller == obj { 157 | affected = true 158 | } 159 | 160 | if affected { 161 | scrollerThicknessChangedHandler?() 162 | } 163 | } 164 | 165 | private var flashVisibilityTimeInterval: TimeInterval { 166 | return 0.80 167 | } 168 | 169 | private var scrollVisibilityTimeInterval: TimeInterval { 170 | return 0.50 171 | } 172 | 173 | private var trackingVisibilityTimeInterval: TimeInterval { 174 | return 0.50 175 | } 176 | 177 | private func scheduleCheck(for interval: TimeInterval) { 178 | precondition(interval > 0.0) 179 | 180 | let time = DispatchTime.now() + .milliseconds(Int(interval * 1000.0)) 181 | let currentTime = Date() 182 | 183 | // because this is just a plain delay, we have to be sure 184 | // we do not keep ourselve alive 185 | DispatchQueue.main.asyncAfter(deadline: time) { [weak self] in 186 | self?.checkVisibility(startingAt: currentTime, interval: interval) 187 | } 188 | } 189 | 190 | private func checkVisibility(startingAt date: Date, interval: TimeInterval) { 191 | let oldHoriz = horizontalState.invisible 192 | let oldVert = verticalState.invisible 193 | 194 | let remainingHoriz = horizontalState.handleVisibilityCheck(with: date) 195 | let remainingVert = verticalState.handleVisibilityCheck(with: date) 196 | 197 | switch (remainingHoriz, remainingVert) { 198 | case (nil, nil): 199 | break 200 | case (let a?, nil): 201 | scheduleCheck(for: a) 202 | case (nil, let b?): 203 | scheduleCheck(for: b) 204 | case (let a?, let b?): 205 | scheduleCheck(for: min(a, b)) 206 | } 207 | 208 | if oldHoriz != horizontalState.invisible || oldVert != verticalState.invisible { 209 | postScrollerVisibilityChanged() 210 | } 211 | } 212 | 213 | } 214 | 215 | extension ScrollerOverlayObserver { 216 | public func flashScrollers() { 217 | let interval = flashVisibilityTimeInterval 218 | let horizVisble = self.horizontalState.handleVisbilityEvent(with: interval) 219 | let vertVisible = self.verticalState.handleVisbilityEvent(with: interval) 220 | 221 | if horizVisble || vertVisible { 222 | postScrollerVisibilityChanged() 223 | } 224 | 225 | // it's safer to check every time, because the expectation is this method 226 | // is called infrequently 227 | scheduleCheck(for: flashVisibilityTimeInterval) 228 | } 229 | 230 | public func scroll(_ clipView: NSClipView, to point: NSPoint) { 231 | let horizScroll = lastPoint.x != point.x 232 | let vertScroll = lastPoint.y != point.y 233 | let interval = scrollVisibilityTimeInterval 234 | 235 | lastPoint = point 236 | 237 | let oldHoriz = horizontalState.invisible 238 | let oldVert = verticalState.invisible 239 | 240 | if horizScroll { 241 | _ = self.horizontalState.handleVisbilityEvent(with: interval) 242 | } 243 | 244 | if vertScroll { 245 | _ = self.verticalState.handleVisbilityEvent(with: interval) 246 | } 247 | 248 | if oldHoriz != horizontalState.invisible || oldVert != verticalState.invisible { 249 | postScrollerVisibilityChanged() 250 | 251 | // here, we only schedule a check if we have transitioned to visible, because 252 | // we know this method gets called a lot 253 | scheduleCheck(for: interval) 254 | } 255 | } 256 | } 257 | -------------------------------------------------------------------------------- /ScrollViewPlus.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | C9742E26275EE6C900E49E90 /* OverlayOnlyScrollViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9742E25275EE6C900E49E90 /* OverlayOnlyScrollViewTests.swift */; }; 11 | C990309C2684E3B000EB1623 /* ScrollViewPlus.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C99030922684E3B000EB1623 /* ScrollViewPlus.framework */; }; 12 | C99030A32684E3B000EB1623 /* ScrollViewPlus.h in Headers */ = {isa = PBXBuildFile; fileRef = C99030952684E3B000EB1623 /* ScrollViewPlus.h */; settings = {ATTRIBUTES = (Public, ); }; }; 13 | C99030AD2684E3D600EB1623 /* ScrollViewVisibleRectObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = C99030AC2684E3D600EB1623 /* ScrollViewVisibleRectObserver.swift */; }; 14 | C99030B32684E6AF00EB1623 /* ObservableScroller.swift in Sources */ = {isa = PBXBuildFile; fileRef = C99030B22684E6AF00EB1623 /* ObservableScroller.swift */; }; 15 | C99030B52684E70100EB1623 /* NSScroller+Thickness.swift in Sources */ = {isa = PBXBuildFile; fileRef = C99030B42684E70100EB1623 /* NSScroller+Thickness.swift */; }; 16 | C99030B72684E72700EB1623 /* ScrollerOverlayObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = C99030B62684E72700EB1623 /* ScrollerOverlayObserver.swift */; }; 17 | C99030B92684F11500EB1623 /* OverlayOnlyScrollView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C99030B82684F11500EB1623 /* OverlayOnlyScrollView.swift */; }; 18 | C99030BB2684F23700EB1623 /* PositionJumpingWorkaroundScrollView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C99030BA2684F23700EB1623 /* PositionJumpingWorkaroundScrollView.swift */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXContainerItemProxy section */ 22 | C990309D2684E3B000EB1623 /* PBXContainerItemProxy */ = { 23 | isa = PBXContainerItemProxy; 24 | containerPortal = C99030892684E3B000EB1623 /* Project object */; 25 | proxyType = 1; 26 | remoteGlobalIDString = C99030912684E3B000EB1623; 27 | remoteInfo = ScrollViewPlus; 28 | }; 29 | /* End PBXContainerItemProxy section */ 30 | 31 | /* Begin PBXFileReference section */ 32 | C9742E25275EE6C900E49E90 /* OverlayOnlyScrollViewTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OverlayOnlyScrollViewTests.swift; sourceTree = ""; }; 33 | C99030922684E3B000EB1623 /* ScrollViewPlus.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ScrollViewPlus.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 34 | C99030952684E3B000EB1623 /* ScrollViewPlus.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScrollViewPlus.h; sourceTree = ""; }; 35 | C99030962684E3B000EB1623 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 36 | C990309B2684E3B000EB1623 /* ScrollViewPlusTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ScrollViewPlusTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 37 | C99030A22684E3B000EB1623 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 38 | C99030AC2684E3D600EB1623 /* ScrollViewVisibleRectObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScrollViewVisibleRectObserver.swift; sourceTree = ""; }; 39 | C99030AE2684E41900EB1623 /* ScrollViewPlus.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ScrollViewPlus.xcconfig; sourceTree = ""; }; 40 | C99030B22684E6AF00EB1623 /* ObservableScroller.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ObservableScroller.swift; sourceTree = ""; }; 41 | C99030B42684E70100EB1623 /* NSScroller+Thickness.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSScroller+Thickness.swift"; sourceTree = ""; }; 42 | C99030B62684E72700EB1623 /* ScrollerOverlayObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScrollerOverlayObserver.swift; sourceTree = ""; }; 43 | C99030B82684F11500EB1623 /* OverlayOnlyScrollView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OverlayOnlyScrollView.swift; sourceTree = ""; }; 44 | C99030BA2684F23700EB1623 /* PositionJumpingWorkaroundScrollView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PositionJumpingWorkaroundScrollView.swift; sourceTree = ""; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | C990308F2684E3B000EB1623 /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | ); 53 | runOnlyForDeploymentPostprocessing = 0; 54 | }; 55 | C99030982684E3B000EB1623 /* Frameworks */ = { 56 | isa = PBXFrameworksBuildPhase; 57 | buildActionMask = 2147483647; 58 | files = ( 59 | C990309C2684E3B000EB1623 /* ScrollViewPlus.framework in Frameworks */, 60 | ); 61 | runOnlyForDeploymentPostprocessing = 0; 62 | }; 63 | /* End PBXFrameworksBuildPhase section */ 64 | 65 | /* Begin PBXGroup section */ 66 | C99030882684E3B000EB1623 = { 67 | isa = PBXGroup; 68 | children = ( 69 | C99030942684E3B000EB1623 /* ScrollViewPlus */, 70 | C990309F2684E3B000EB1623 /* ScrollViewPlusTests */, 71 | C99030932684E3B000EB1623 /* Products */, 72 | ); 73 | sourceTree = ""; 74 | }; 75 | C99030932684E3B000EB1623 /* Products */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | C99030922684E3B000EB1623 /* ScrollViewPlus.framework */, 79 | C990309B2684E3B000EB1623 /* ScrollViewPlusTests.xctest */, 80 | ); 81 | name = Products; 82 | sourceTree = ""; 83 | }; 84 | C99030942684E3B000EB1623 /* ScrollViewPlus */ = { 85 | isa = PBXGroup; 86 | children = ( 87 | C99030952684E3B000EB1623 /* ScrollViewPlus.h */, 88 | C99030962684E3B000EB1623 /* Info.plist */, 89 | C99030AC2684E3D600EB1623 /* ScrollViewVisibleRectObserver.swift */, 90 | C99030AE2684E41900EB1623 /* ScrollViewPlus.xcconfig */, 91 | C99030B22684E6AF00EB1623 /* ObservableScroller.swift */, 92 | C99030B42684E70100EB1623 /* NSScroller+Thickness.swift */, 93 | C99030B62684E72700EB1623 /* ScrollerOverlayObserver.swift */, 94 | C99030B82684F11500EB1623 /* OverlayOnlyScrollView.swift */, 95 | C99030BA2684F23700EB1623 /* PositionJumpingWorkaroundScrollView.swift */, 96 | ); 97 | path = ScrollViewPlus; 98 | sourceTree = ""; 99 | }; 100 | C990309F2684E3B000EB1623 /* ScrollViewPlusTests */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | C9742E25275EE6C900E49E90 /* OverlayOnlyScrollViewTests.swift */, 104 | C99030A22684E3B000EB1623 /* Info.plist */, 105 | ); 106 | path = ScrollViewPlusTests; 107 | sourceTree = ""; 108 | }; 109 | /* End PBXGroup section */ 110 | 111 | /* Begin PBXHeadersBuildPhase section */ 112 | C990308D2684E3B000EB1623 /* Headers */ = { 113 | isa = PBXHeadersBuildPhase; 114 | buildActionMask = 2147483647; 115 | files = ( 116 | C99030A32684E3B000EB1623 /* ScrollViewPlus.h in Headers */, 117 | ); 118 | runOnlyForDeploymentPostprocessing = 0; 119 | }; 120 | /* End PBXHeadersBuildPhase section */ 121 | 122 | /* Begin PBXNativeTarget section */ 123 | C99030912684E3B000EB1623 /* ScrollViewPlus */ = { 124 | isa = PBXNativeTarget; 125 | buildConfigurationList = C99030A62684E3B000EB1623 /* Build configuration list for PBXNativeTarget "ScrollViewPlus" */; 126 | buildPhases = ( 127 | C990308D2684E3B000EB1623 /* Headers */, 128 | C990308E2684E3B000EB1623 /* Sources */, 129 | C990308F2684E3B000EB1623 /* Frameworks */, 130 | C99030902684E3B000EB1623 /* Resources */, 131 | ); 132 | buildRules = ( 133 | ); 134 | dependencies = ( 135 | ); 136 | name = ScrollViewPlus; 137 | productName = ScrollViewPlus; 138 | productReference = C99030922684E3B000EB1623 /* ScrollViewPlus.framework */; 139 | productType = "com.apple.product-type.framework"; 140 | }; 141 | C990309A2684E3B000EB1623 /* ScrollViewPlusTests */ = { 142 | isa = PBXNativeTarget; 143 | buildConfigurationList = C99030A92684E3B000EB1623 /* Build configuration list for PBXNativeTarget "ScrollViewPlusTests" */; 144 | buildPhases = ( 145 | C99030972684E3B000EB1623 /* Sources */, 146 | C99030982684E3B000EB1623 /* Frameworks */, 147 | C99030992684E3B000EB1623 /* Resources */, 148 | ); 149 | buildRules = ( 150 | ); 151 | dependencies = ( 152 | C990309E2684E3B000EB1623 /* PBXTargetDependency */, 153 | ); 154 | name = ScrollViewPlusTests; 155 | productName = ScrollViewPlusTests; 156 | productReference = C990309B2684E3B000EB1623 /* ScrollViewPlusTests.xctest */; 157 | productType = "com.apple.product-type.bundle.unit-test"; 158 | }; 159 | /* End PBXNativeTarget section */ 160 | 161 | /* Begin PBXProject section */ 162 | C99030892684E3B000EB1623 /* Project object */ = { 163 | isa = PBXProject; 164 | attributes = { 165 | LastSwiftUpdateCheck = 1250; 166 | LastUpgradeCheck = 1250; 167 | TargetAttributes = { 168 | C99030912684E3B000EB1623 = { 169 | CreatedOnToolsVersion = 12.5; 170 | LastSwiftMigration = 1250; 171 | }; 172 | C990309A2684E3B000EB1623 = { 173 | CreatedOnToolsVersion = 12.5; 174 | LastSwiftMigration = 1320; 175 | }; 176 | }; 177 | }; 178 | buildConfigurationList = C990308C2684E3B000EB1623 /* Build configuration list for PBXProject "ScrollViewPlus" */; 179 | compatibilityVersion = "Xcode 9.3"; 180 | developmentRegion = en; 181 | hasScannedForEncodings = 0; 182 | knownRegions = ( 183 | en, 184 | Base, 185 | ); 186 | mainGroup = C99030882684E3B000EB1623; 187 | productRefGroup = C99030932684E3B000EB1623 /* Products */; 188 | projectDirPath = ""; 189 | projectRoot = ""; 190 | targets = ( 191 | C99030912684E3B000EB1623 /* ScrollViewPlus */, 192 | C990309A2684E3B000EB1623 /* ScrollViewPlusTests */, 193 | ); 194 | }; 195 | /* End PBXProject section */ 196 | 197 | /* Begin PBXResourcesBuildPhase section */ 198 | C99030902684E3B000EB1623 /* Resources */ = { 199 | isa = PBXResourcesBuildPhase; 200 | buildActionMask = 2147483647; 201 | files = ( 202 | ); 203 | runOnlyForDeploymentPostprocessing = 0; 204 | }; 205 | C99030992684E3B000EB1623 /* Resources */ = { 206 | isa = PBXResourcesBuildPhase; 207 | buildActionMask = 2147483647; 208 | files = ( 209 | ); 210 | runOnlyForDeploymentPostprocessing = 0; 211 | }; 212 | /* End PBXResourcesBuildPhase section */ 213 | 214 | /* Begin PBXSourcesBuildPhase section */ 215 | C990308E2684E3B000EB1623 /* Sources */ = { 216 | isa = PBXSourcesBuildPhase; 217 | buildActionMask = 2147483647; 218 | files = ( 219 | C99030B92684F11500EB1623 /* OverlayOnlyScrollView.swift in Sources */, 220 | C99030B72684E72700EB1623 /* ScrollerOverlayObserver.swift in Sources */, 221 | C99030B52684E70100EB1623 /* NSScroller+Thickness.swift in Sources */, 222 | C99030BB2684F23700EB1623 /* PositionJumpingWorkaroundScrollView.swift in Sources */, 223 | C99030B32684E6AF00EB1623 /* ObservableScroller.swift in Sources */, 224 | C99030AD2684E3D600EB1623 /* ScrollViewVisibleRectObserver.swift in Sources */, 225 | ); 226 | runOnlyForDeploymentPostprocessing = 0; 227 | }; 228 | C99030972684E3B000EB1623 /* Sources */ = { 229 | isa = PBXSourcesBuildPhase; 230 | buildActionMask = 2147483647; 231 | files = ( 232 | C9742E26275EE6C900E49E90 /* OverlayOnlyScrollViewTests.swift in Sources */, 233 | ); 234 | runOnlyForDeploymentPostprocessing = 0; 235 | }; 236 | /* End PBXSourcesBuildPhase section */ 237 | 238 | /* Begin PBXTargetDependency section */ 239 | C990309E2684E3B000EB1623 /* PBXTargetDependency */ = { 240 | isa = PBXTargetDependency; 241 | target = C99030912684E3B000EB1623 /* ScrollViewPlus */; 242 | targetProxy = C990309D2684E3B000EB1623 /* PBXContainerItemProxy */; 243 | }; 244 | /* End PBXTargetDependency section */ 245 | 246 | /* Begin XCBuildConfiguration section */ 247 | C99030A42684E3B000EB1623 /* Debug */ = { 248 | isa = XCBuildConfiguration; 249 | buildSettings = { 250 | ALWAYS_SEARCH_USER_PATHS = NO; 251 | CLANG_ANALYZER_NONNULL = YES; 252 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 253 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 254 | CLANG_CXX_LIBRARY = "libc++"; 255 | CLANG_ENABLE_MODULES = YES; 256 | CLANG_ENABLE_OBJC_ARC = YES; 257 | CLANG_ENABLE_OBJC_WEAK = YES; 258 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 259 | CLANG_WARN_BOOL_CONVERSION = YES; 260 | CLANG_WARN_COMMA = YES; 261 | CLANG_WARN_CONSTANT_CONVERSION = YES; 262 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 263 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 264 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 265 | CLANG_WARN_EMPTY_BODY = YES; 266 | CLANG_WARN_ENUM_CONVERSION = YES; 267 | CLANG_WARN_INFINITE_RECURSION = YES; 268 | CLANG_WARN_INT_CONVERSION = YES; 269 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 270 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 271 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 272 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 273 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 274 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 275 | CLANG_WARN_STRICT_PROTOTYPES = YES; 276 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 277 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 278 | CLANG_WARN_UNREACHABLE_CODE = YES; 279 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 280 | COPY_PHASE_STRIP = NO; 281 | CURRENT_PROJECT_VERSION = 1; 282 | DEBUG_INFORMATION_FORMAT = dwarf; 283 | ENABLE_STRICT_OBJC_MSGSEND = YES; 284 | ENABLE_TESTABILITY = YES; 285 | GCC_C_LANGUAGE_STANDARD = gnu11; 286 | GCC_DYNAMIC_NO_PIC = NO; 287 | GCC_NO_COMMON_BLOCKS = YES; 288 | GCC_OPTIMIZATION_LEVEL = 0; 289 | GCC_PREPROCESSOR_DEFINITIONS = ( 290 | "DEBUG=1", 291 | "$(inherited)", 292 | ); 293 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 294 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 295 | GCC_WARN_UNDECLARED_SELECTOR = YES; 296 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 297 | GCC_WARN_UNUSED_FUNCTION = YES; 298 | GCC_WARN_UNUSED_VARIABLE = YES; 299 | MACOSX_DEPLOYMENT_TARGET = 11.3; 300 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 301 | MTL_FAST_MATH = YES; 302 | ONLY_ACTIVE_ARCH = YES; 303 | SDKROOT = macosx; 304 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 305 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 306 | VERSIONING_SYSTEM = "apple-generic"; 307 | VERSION_INFO_PREFIX = ""; 308 | }; 309 | name = Debug; 310 | }; 311 | C99030A52684E3B000EB1623 /* Release */ = { 312 | isa = XCBuildConfiguration; 313 | buildSettings = { 314 | ALWAYS_SEARCH_USER_PATHS = NO; 315 | CLANG_ANALYZER_NONNULL = YES; 316 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 317 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 318 | CLANG_CXX_LIBRARY = "libc++"; 319 | CLANG_ENABLE_MODULES = YES; 320 | CLANG_ENABLE_OBJC_ARC = YES; 321 | CLANG_ENABLE_OBJC_WEAK = YES; 322 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 323 | CLANG_WARN_BOOL_CONVERSION = YES; 324 | CLANG_WARN_COMMA = YES; 325 | CLANG_WARN_CONSTANT_CONVERSION = YES; 326 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 327 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 328 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 329 | CLANG_WARN_EMPTY_BODY = YES; 330 | CLANG_WARN_ENUM_CONVERSION = YES; 331 | CLANG_WARN_INFINITE_RECURSION = YES; 332 | CLANG_WARN_INT_CONVERSION = YES; 333 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 334 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 335 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 336 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 337 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 338 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 339 | CLANG_WARN_STRICT_PROTOTYPES = YES; 340 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 341 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 342 | CLANG_WARN_UNREACHABLE_CODE = YES; 343 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 344 | COPY_PHASE_STRIP = NO; 345 | CURRENT_PROJECT_VERSION = 1; 346 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 347 | ENABLE_NS_ASSERTIONS = NO; 348 | ENABLE_STRICT_OBJC_MSGSEND = YES; 349 | GCC_C_LANGUAGE_STANDARD = gnu11; 350 | GCC_NO_COMMON_BLOCKS = YES; 351 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 352 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 353 | GCC_WARN_UNDECLARED_SELECTOR = YES; 354 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 355 | GCC_WARN_UNUSED_FUNCTION = YES; 356 | GCC_WARN_UNUSED_VARIABLE = YES; 357 | MACOSX_DEPLOYMENT_TARGET = 11.3; 358 | MTL_ENABLE_DEBUG_INFO = NO; 359 | MTL_FAST_MATH = YES; 360 | SDKROOT = macosx; 361 | SWIFT_COMPILATION_MODE = wholemodule; 362 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 363 | VERSIONING_SYSTEM = "apple-generic"; 364 | VERSION_INFO_PREFIX = ""; 365 | }; 366 | name = Release; 367 | }; 368 | C99030A72684E3B000EB1623 /* Debug */ = { 369 | isa = XCBuildConfiguration; 370 | baseConfigurationReference = C99030AE2684E41900EB1623 /* ScrollViewPlus.xcconfig */; 371 | buildSettings = { 372 | CLANG_ENABLE_MODULES = YES; 373 | CODE_SIGN_STYLE = Automatic; 374 | COMBINE_HIDPI_IMAGES = YES; 375 | DEFINES_MODULE = YES; 376 | DYLIB_COMPATIBILITY_VERSION = 1; 377 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 378 | INFOPLIST_FILE = ScrollViewPlus/Info.plist; 379 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 380 | LD_RUNPATH_SEARCH_PATHS = ( 381 | "$(inherited)", 382 | "@executable_path/../Frameworks", 383 | "@loader_path/Frameworks", 384 | ); 385 | PRODUCT_BUNDLE_IDENTIFIER = com.chimehq.ScrollViewPlus; 386 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 387 | SKIP_INSTALL = YES; 388 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 389 | }; 390 | name = Debug; 391 | }; 392 | C99030A82684E3B000EB1623 /* Release */ = { 393 | isa = XCBuildConfiguration; 394 | baseConfigurationReference = C99030AE2684E41900EB1623 /* ScrollViewPlus.xcconfig */; 395 | buildSettings = { 396 | CLANG_ENABLE_MODULES = YES; 397 | CODE_SIGN_STYLE = Automatic; 398 | COMBINE_HIDPI_IMAGES = YES; 399 | DEFINES_MODULE = YES; 400 | DYLIB_COMPATIBILITY_VERSION = 1; 401 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 402 | INFOPLIST_FILE = ScrollViewPlus/Info.plist; 403 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 404 | LD_RUNPATH_SEARCH_PATHS = ( 405 | "$(inherited)", 406 | "@executable_path/../Frameworks", 407 | "@loader_path/Frameworks", 408 | ); 409 | PRODUCT_BUNDLE_IDENTIFIER = com.chimehq.ScrollViewPlus; 410 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 411 | SKIP_INSTALL = YES; 412 | }; 413 | name = Release; 414 | }; 415 | C99030AA2684E3B000EB1623 /* Debug */ = { 416 | isa = XCBuildConfiguration; 417 | buildSettings = { 418 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 419 | CLANG_ENABLE_MODULES = YES; 420 | CODE_SIGN_STYLE = Automatic; 421 | COMBINE_HIDPI_IMAGES = YES; 422 | INFOPLIST_FILE = ScrollViewPlusTests/Info.plist; 423 | LD_RUNPATH_SEARCH_PATHS = ( 424 | "$(inherited)", 425 | "@executable_path/../Frameworks", 426 | "@loader_path/../Frameworks", 427 | ); 428 | PRODUCT_BUNDLE_IDENTIFIER = com.chimehq.ScrollViewPlusTests; 429 | PRODUCT_NAME = "$(TARGET_NAME)"; 430 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 431 | SWIFT_VERSION = 5.0; 432 | }; 433 | name = Debug; 434 | }; 435 | C99030AB2684E3B000EB1623 /* Release */ = { 436 | isa = XCBuildConfiguration; 437 | buildSettings = { 438 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 439 | CLANG_ENABLE_MODULES = YES; 440 | CODE_SIGN_STYLE = Automatic; 441 | COMBINE_HIDPI_IMAGES = YES; 442 | INFOPLIST_FILE = ScrollViewPlusTests/Info.plist; 443 | LD_RUNPATH_SEARCH_PATHS = ( 444 | "$(inherited)", 445 | "@executable_path/../Frameworks", 446 | "@loader_path/../Frameworks", 447 | ); 448 | PRODUCT_BUNDLE_IDENTIFIER = com.chimehq.ScrollViewPlusTests; 449 | PRODUCT_NAME = "$(TARGET_NAME)"; 450 | SWIFT_VERSION = 5.0; 451 | }; 452 | name = Release; 453 | }; 454 | /* End XCBuildConfiguration section */ 455 | 456 | /* Begin XCConfigurationList section */ 457 | C990308C2684E3B000EB1623 /* Build configuration list for PBXProject "ScrollViewPlus" */ = { 458 | isa = XCConfigurationList; 459 | buildConfigurations = ( 460 | C99030A42684E3B000EB1623 /* Debug */, 461 | C99030A52684E3B000EB1623 /* Release */, 462 | ); 463 | defaultConfigurationIsVisible = 0; 464 | defaultConfigurationName = Release; 465 | }; 466 | C99030A62684E3B000EB1623 /* Build configuration list for PBXNativeTarget "ScrollViewPlus" */ = { 467 | isa = XCConfigurationList; 468 | buildConfigurations = ( 469 | C99030A72684E3B000EB1623 /* Debug */, 470 | C99030A82684E3B000EB1623 /* Release */, 471 | ); 472 | defaultConfigurationIsVisible = 0; 473 | defaultConfigurationName = Release; 474 | }; 475 | C99030A92684E3B000EB1623 /* Build configuration list for PBXNativeTarget "ScrollViewPlusTests" */ = { 476 | isa = XCConfigurationList; 477 | buildConfigurations = ( 478 | C99030AA2684E3B000EB1623 /* Debug */, 479 | C99030AB2684E3B000EB1623 /* Release */, 480 | ); 481 | defaultConfigurationIsVisible = 0; 482 | defaultConfigurationName = Release; 483 | }; 484 | /* End XCConfigurationList section */ 485 | }; 486 | rootObject = C99030892684E3B000EB1623 /* Project object */; 487 | } 488 | --------------------------------------------------------------------------------