{"id":1314,"url":"https://github.com/exyte/ScalingHeaderScrollView","last_synced_at":"2025-08-06T13:32:46.270Z","repository":{"id":37331244,"uuid":"407139075","full_name":"exyte/ScalingHeaderScrollView","owner":"exyte","description":"A scroll view with a sticky header which shrinks as you scroll. Written with SwiftUI.","archived":false,"fork":false,"pushed_at":"2025-07-22T03:40:46.000Z","size":30774,"stargazers_count":1381,"open_issues_count":4,"forks_count":102,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-08-05T08:19:27.332Z","etag":null,"topics":["headerview","ios","scrollview","sticky-headers","swift","swiftui","swiftui-components"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/exyte.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-09-16T11:31:18.000Z","updated_at":"2025-08-05T07:57:02.000Z","dependencies_parsed_at":"2022-07-10T00:46:28.269Z","dependency_job_id":"fb205172-c5b2-48dc-8326-7e2017e00c78","html_url":"https://github.com/exyte/ScalingHeaderScrollView","commit_stats":{"total_commits":130,"total_committers":15,"mean_commits":8.666666666666666,"dds":0.6153846153846154,"last_synced_commit":"87cc269444490be1ba231038718267aceca1f895"},"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"purl":"pkg:github/exyte/ScalingHeaderScrollView","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exyte%2FScalingHeaderScrollView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exyte%2FScalingHeaderScrollView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exyte%2FScalingHeaderScrollView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exyte%2FScalingHeaderScrollView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/exyte","download_url":"https://codeload.github.com/exyte/ScalingHeaderScrollView/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exyte%2FScalingHeaderScrollView/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268910362,"owners_count":24327507,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-05T02:00:12.334Z","response_time":2576,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["headerview","ios","scrollview","sticky-headers","swift","swiftui","swiftui-components"],"created_at":"2024-01-05T20:15:43.616Z","updated_at":"2025-08-06T13:32:46.258Z","avatar_url":"https://github.com/exyte.png","language":"Swift","readme":"\u003ca href=\"https://exyte.com/\"\u003e\u003cpicture\u003e\u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/exyte/media/master/common/header-dark.png\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/exyte/media/master/common/header-light.png\"\u003e\u003c/picture\u003e\u003c/a\u003e\n\n\u003ca href=\"https://exyte.com/\"\u003e\u003cpicture\u003e\u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/exyte/media/master/common/our-site-dark.png\" width=\"80\" height=\"16\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/exyte/media/master/common/our-site-light.png\" width=\"80\" height=\"16\"\u003e\u003c/picture\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u003ca href=\"https://twitter.com/exyteHQ\"\u003e\u003cpicture\u003e\u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/exyte/media/master/common/twitter-dark.png\" width=\"74\" height=\"16\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/exyte/media/master/common/twitter-light.png\" width=\"74\" height=\"16\"\u003e\n\u003c/picture\u003e\u003c/a\u003e \u003ca href=\"https://exyte.com/contacts\"\u003e\u003cpicture\u003e\u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/exyte/media/master/common/get-in-touch-dark.png\" width=\"128\" height=\"24\" align=\"right\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/exyte/media/master/common/get-in-touch-light.png\" width=\"128\" height=\"24\" align=\"right\"\u003e\u003c/picture\u003e\u003c/a\u003e\n\n\u003cp float=\"left\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/exyte/media/master/ScalingHeaderScrollView/1.gif\" width=\"200\" /\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/exyte/media/master/ScalingHeaderScrollView/2.gif\" width=\"200\" /\u003e \n  \u003cimg src=\"https://raw.githubusercontent.com/exyte/media/master/ScalingHeaderScrollView/3.gif\" width=\"200\" /\u003e\n\u003c/p\u003e\n\u003cp\u003e\u003ch1 align=\"left\"\u003eScaling Header Scroll View\u003c/h1\u003e\u003c/p\u003e\n\n\u003cp\u003e\u003ch4\u003eA scroll view with a sticky header which shrinks as you scroll. Written with SwiftUI.\u003c/h4\u003e\u003c/p\u003e\n\n\u003ca href=\"https://exyte.com/blog/swiftui-tutorial-scaling-header\"\u003eRead Article »\u003c/a\u003e\n\n![](https://img.shields.io/github/v/tag/exyte/ScalingHeaderScrollView?label=Version)\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fexyte%2FScalingHeaderScrollView%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/exyte/ScalingHeaderScrollView)\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fexyte%2FScalingHeaderScrollView%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/exyte/ScalingHeaderScrollView)\n[![SPM](https://img.shields.io/badge/SPM-Compatible-brightgreen.svg)](https://swiftpackageindex.com/exyte/ScalingHeaderScrollView)\n[![Cocoapods](https://img.shields.io/badge/Cocoapods-Deprecated%20after%201.1.4-yellow.svg)](https://cocoapods.org/pods/ScalingHeaderScrollView)\n[![License: MIT](https://img.shields.io/badge/License-MIT-black.svg)](https://opensource.org/licenses/MIT)\n\n# Usage\n1. Put your header and content bodies code into a ScalingHeaderScrollView constructor.     \n2. Set the necessary modifiers, see below.      \n```swift\nstruct ContentView: View {\n\n    var body: some View {\n       ScalingHeaderScrollView {\n            ZStack {\n                Rectangle()\n                    .fill(.gray.opacity(0.15))\n                Image(\"header\")\n            }\n        } content: {\n            Text(\"↓ Pull to refresh ↓\")\n                .multilineTextAlignment(.center)\n                .padding()\n        }\n    }\n}\n```\n\n## TabView won't work\n\nPlease note that `ScalingScrollview` is just a `ScrollView` under the hood, so it works very similar to it. If content's height changes between tabs inside the scroll view, there is no way to keep scroll position nice and stable. Usually when using a `TabView`, you put separate `ScrollView`s on every tab, not the other way around. And if you were to put a `TabView` inside a `ScrollView`, it wouldn't work as you expect, and neither will putting it inside a `ScalingScrollview`.  \n\nMoreover, `TabView` gives almost no control over itself (getting/setting its current position, getting tab's content height, etc.), so there is no way to manually mess with its `scrollOffset`, which is what this library relies heavily upon.  \n\n### Required parameters \n`header` - `@ViewBuilder` for your header  \n`content` - `@ViewBuilder` for your content  \n\n### Available modifiers, optional  \npasses current collapse progress value into progress binding: 0 for not collapsed at all, 1 - for fully collapsed       \n```swift\n.collapseProgress(_ progress: Binding\u003cCGFloat\u003e)\n```\n\nallows to set up callback for ScrollView reaching the bottom     \n```swift\n.scrollViewDidReachBottom(perform: @escaping () -\u003e Void)\n```\n\nallows to set up an action for pull-to-refresh; if not set up loading indicator on pull-to-refresh will never be displayed\n```swift\n.pullToRefresh(isActive: Bool, perform: () async -\u003e Void)\n```\n`isActive` - dynamically enable/disable pull-to-refresh, if disabled, loading indicator won't be displayed on pull-to-refresh   \n`perform` - async closure to be performed on pull-to-refresh, after the closure is done loading indicator will be hidden automatically     \n \nallows to set up an action for pull-to-load-more; if not set up loading indicator on pull-to-load-more will never be displayed\n```swift\n.pullToLoadMore(isActive: Bool, contentOffset: CGFloat, perform: () async -\u003e Void)\n```\n`isActive` - dynamically enable/disable pull-to-load-more, if disabled, loading indicator won't be displayed on pull-to-load-more   \n`contentOffset` - padding value of the content from the bottom edge when pull-to-load is active    \n`perform` - async closure to be performed on pull-to-load-more, after the closure is done loading indicator will be hidden automatically   \n\n allows content scroll reset, need to change Binding to `true`  \n```swift\n.scrollToTop(resetScroll: Binding\u003cBool\u003e)\n```\n\n allows to change current header height, need to change state, possible values are .collapsed, .expanded or .custom(CFGloat)\n```swift\n.snapHeaderToState(state: Binding\u003cSnapHeaderState?\u003e, animated: Bool)\n```\n\n changes min and max heights of Header, default `min = 150.0` and `max = 350.0`  \n```swift\n.height(min: CGFloat = 150.0, max: CGFloat = 350.0)\n```\n\nwhen scrolling up - switch between actual header collapse and simply moving it up (by default moving up)\n```swift\n.allowsHeaderCollapse()\n```\n\nwhen scrolling down - enable (disabled by default) header scale    \n```swift\n.allowsHeaderGrowth()\n```\n\nEnable/disable (disabled by default) header snap. Available modes:\n- `.disabled` - Disable header snap.\n- `.immediately` - Once you lift your finger header snaps either to min or max height automatically.\n- `.afterFinishAccelerating` - At the end of scroll view deceleration the header snaps either to min or max height automatically.\n```swift\n.setHeaderSnapMode(.immediately)\n```\n\nSet custom positions for header snap (explained previous point). Specify any amount of values in 0...1 to set snapping points, 0 - fully collapsed header, 1 - fully expanded  \n```swift\n.headerSnappingPositions(snapPositions: [CGFloat])\n```\n\nSet custom initial position to which scroll view will be automatically snapped to. Specify a value in 0...1, 0 - fully collapsed header, 1 - fully expanded  \n```swift\n.initialSnapPosition(initialSnapPosition: CGFloat)\n```\n\nhide scroll indicators (false by default)  \n```swift\n.hideScrollIndicators()\n```\n\n## Examples\n\nTo try the ScalingHeaderScrollView examples:\n- Clone the repo `https://github.com/exyte/ScalingHeaderScrollView.git`\n- Open `ScalingHeaderScrollViewExample.xcodeproj` in the Xcode\n- Try it!\n\n## Installation\n\n### [Swift Package Manager](https://swift.org/package-manager/)\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/exyte/ScalingHeaderScrollView.git\")\n]\n```\n\n## Requirements\n\n* iOS 14+\n* Xcode 12+ \n\n## Our other open source SwiftUI libraries\n[PopupView](https://github.com/exyte/PopupView) - Toasts and popups library    \n[AnchoredPopup](https://github.com/exyte/AnchoredPopup) - Anchored Popup grows \"out\" of a trigger view (similar to Hero animation)  \n[Grid](https://github.com/exyte/Grid) - The most powerful Grid container     \n[AnimatedTabBar](https://github.com/exyte/AnimatedTabBar) - A tabbar with a number of preset animations   \n[MediaPicker](https://github.com/exyte/mediapicker) - Customizable media picker     \n[Chat](https://github.com/exyte/chat) - Chat UI framework with fully customizable message cells, input view, and a built-in media picker  \n[OpenAI](https://github.com/exyte/OpenAI) Wrapper lib for [OpenAI REST API](https://platform.openai.com/docs/api-reference/introduction)    \n[AnimatedGradient](https://github.com/exyte/AnimatedGradient) - Animated linear gradient     \n[ConcentricOnboarding](https://github.com/exyte/ConcentricOnboarding) - Animated onboarding flow    \n[FloatingButton](https://github.com/exyte/FloatingButton) - Floating button menu    \n[ActivityIndicatorView](https://github.com/exyte/ActivityIndicatorView) - A number of animated loading indicators    \n[ProgressIndicatorView](https://github.com/exyte/ProgressIndicatorView) - A number of animated progress indicators    \n[FlagAndCountryCode](https://github.com/exyte/FlagAndCountryCode) - Phone codes and flags for every country    \n[SVGView](https://github.com/exyte/SVGView) - SVG parser    \n[LiquidSwipe](https://github.com/exyte/LiquidSwipe) - Liquid navigation animation    \n","funding_links":[],"categories":["Layout","Libs"],"sub_categories":["Other Hardware","Layout"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexyte%2FScalingHeaderScrollView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexyte%2FScalingHeaderScrollView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexyte%2FScalingHeaderScrollView/lists"}