---
title: "Adding a sticky header to a SwiftUI ScrollView"
url: https://daily.dev/posts/adding-a-sticky-header-to-a-swiftui-scrollview-c6zsrdknw
source_url: https://danielsaidi.com/blog/2023/02/09/adding-a-sticky-header-to-a-swiftui-scroll-view
type: article
source: "Daniel Saidi"
published: 2026-07-05T07:13:59.758Z
updated: 2026-07-05T07:19:06.323Z
tags: ["ios", "swift", "swiftui"]
reading_time: 13
upvotes: 0
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Adding a sticky header to a SwiftUI ScrollView

**[Daniel Saidi](https://daily.dev/sources/danielsaidi)** · 13 min read · 0 upvotes · 0 comments

## Summary

A step-by-step guide to building a sticky, stretchy scroll view header in SwiftUI, similar to the Spotify album screen. Covers combining scroll offset tracking (via preference keys and coordinate namespaces) with a stretchable header (GeometryReader) to create a ScrollViewWithStickyHeader component. Explains how to calculate a headerVisibleRatio, overlay a second header when the original scrolls past the navigation bar, make the navbar transparent using toolbarBackground, and add bonus pull-down tilt (rotation3DEffect) and parallax (vertical offset) effects. The final component is available in the open-source ScrollKit library.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://danielsaidi.com/blog/2023/02/09/adding-a-sticky-header-to-a-swiftui-scroll-view>

---

Tags: [#ios](https://daily.dev/tags/ios), [#swift](https://daily.dev/tags/swift), [#swiftui](https://daily.dev/tags/swiftui)

[View this post on daily.dev](https://daily.dev/posts/adding-a-sticky-header-to-a-swiftui-scrollview-c6zsrdknw)
