{"id":2903,"url":"https://github.com/gskbyte/GSKStretchyHeaderView","last_synced_at":"2025-08-03T12:31:32.821Z","repository":{"id":4298000,"uuid":"52670535","full_name":"gskbyte/GSKStretchyHeaderView","owner":"gskbyte","description":"A generic stretchy header for UITableView and UICollectionView","archived":false,"fork":false,"pushed_at":"2024-08-06T14:18:14.000Z","size":5687,"stargazers_count":1753,"open_issues_count":12,"forks_count":187,"subscribers_count":34,"default_branch":"master","last_synced_at":"2024-10-29T17:56:42.363Z","etag":null,"topics":["interface-builder","ios","stretchy-headers","uicollectionview","uikit","uiscrollview","uitableview","uiview"],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","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/gskbyte.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2016-02-27T14:30:08.000Z","updated_at":"2024-10-21T14:33:32.000Z","dependencies_parsed_at":"2024-11-19T18:17:54.169Z","dependency_job_id":"33cf00c4-0567-44fb-8f7f-2371d10dff49","html_url":"https://github.com/gskbyte/GSKStretchyHeaderView","commit_stats":{"total_commits":151,"total_committers":9,"mean_commits":16.77777777777778,"dds":0.304635761589404,"last_synced_commit":"83a183114a56e1651fc025f26d02eae71e377d27"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gskbyte%2FGSKStretchyHeaderView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gskbyte%2FGSKStretchyHeaderView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gskbyte%2FGSKStretchyHeaderView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gskbyte%2FGSKStretchyHeaderView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gskbyte","download_url":"https://codeload.github.com/gskbyte/GSKStretchyHeaderView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228061815,"owners_count":17863369,"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","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":["interface-builder","ios","stretchy-headers","uicollectionview","uikit","uiscrollview","uitableview","uiview"],"created_at":"2024-01-05T20:16:25.898Z","updated_at":"2024-12-07T00:31:04.526Z","avatar_url":"https://github.com/gskbyte.png","language":"Objective-C","funding_links":[],"categories":["UI"],"sub_categories":["Table View / Collection View","Layout","Other free courses"],"readme":"# GSKStretchyHeaderView, by [gskbyte](https://twitter.com/gskbyte)\n\n[![License](https://img.shields.io/cocoapods/l/GSKStretchyHeaderView.svg?style=flat)](http://cocoapods.org/pods/GSKStretchyHeaderView)\n[![Platform](https://img.shields.io/cocoapods/p/GSKStretchyHeaderView.svg?style=flat)](http://cocoapods.org/pods/GSKStretchyHeaderView)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Version](https://img.shields.io/cocoapods/v/GSKStretchyHeaderView.svg?style=flat)](http://cocoapods.org/pods/GSKStretchyHeaderView)\n\n[![CI Status](https://travis-ci.org/gskbyte/GSKStretchyHeaderView.svg?branch=master)](https://travis-ci.org/gskbyte/GSKStretchyHeaderView)\n[![Coverage](https://coveralls.io/repos/github/gskbyte/GSKStretchyHeaderView/badge.svg)](https://coveralls.io/github/gskbyte/GSKStretchyHeaderView)\n\n![Example 1](https://raw.githubusercontent.com/gskbyte/GSKStretchyHeaderView/master/screenshots/airbnb_small.gif)\n![Example 2](https://raw.githubusercontent.com/gskbyte/GSKStretchyHeaderView/master/screenshots/stretchy_blur_small.gif)\n![Example 3](https://raw.githubusercontent.com/gskbyte/GSKStretchyHeaderView/master/screenshots/tabs_small.gif)\n![Example 4](https://raw.githubusercontent.com/gskbyte/GSKStretchyHeaderView/master/screenshots/twitter_small.gif)\n![Example 5](https://raw.githubusercontent.com/gskbyte/GSKStretchyHeaderView/master/screenshots/scalable_text_small.gif)\n\nGSKStretchyHeaderView is an implementation of the stretchy header paradigm as seen on many apps, like Twitter, Spotify or airbnb. It's designed in order to accomplish the following requirements:\n\n- Compatibility with `UITableView` and `UICollectionView`\n- Data source and delegate independency: can be added to an existing view controller withouth interfering with your existing `delegate` or `dataSource`\n- Provide support for frame layout, auto layout and Interface Builder `.xib` files\n- No need to subclass a custom view controller or to use a custom `UICollectionViewLayout`\n- Simple usage: just implement your own subclass and add it to your `UIScrollView` subclass\n- Two expansion modes: the header view can grow only when the top of the scroll view is reached, or as soon as the user scrolls down.\n\nIf you are using this library in your project, I would be more than glad to [know about it!](mailto:gskbyte@gmail.com)\n\n## Usage\n\nTo add a stretchy header to your table or collection view, you just have to do this:\n\n```swift\n\nvar stretchyHeader: GSKStretchyHeaderViewSubclass!\n\n...\n\nfunc viewDidLoad() {\n    super.viewDidLoad()\n    let headerSize = CGSize(width: self.tableView.frame.size.width, \n                            height: 200) // 200 will be the default height\n    self.stretchyHeader = GSKStretchyHeaderViewSubclass(frame: CGRect(x: 0, y: 0,\n                                                                      width: headerSize.width, \n                                                                      height: headerSize.height))\n    self.stretchyHeader.delegate = self // this is completely optional\n    self.tableView.addSubview(self.stretchyHeader)\n}\n```\nor\n```swift\nfunc viewDidLoad() {\n    super.viewDidLoad()\n    let nibViews = Bundle.main.loadNibNamed(\"GSKTabsStretchyHeaderView\", owner: self, options: nil)\n    self.stretchyHeaderView = nibViews.firstObject\n    self.tableView.addSubview(self.stretchyHeaderView)\n}\n```\n\n## Compatibility with iOS 11 and the iPhone X\n\nAfter the changes introduced in iOS 11, some issues have appeared with the safe area adjustments to scroll views. To avoid glitches and strange behaviours, just do the following when you set up your header view:\n\n```swift\nif #available(iOS 11.0, *) {\n    self.tableView.contentInsetAdjustmentBehavior = .never\n}\n```\n\nFor the time being, we haven't found a better way to deal with the `contentInset` adjustment, so the support for the iPhone X and the `safeAreaInsets` is not there yet. This may require a major refactor of the header view and a major release. For more information, see [this issue](https://github.com/gskbyte/GSKStretchyHeaderView/issues/63) and [this PR (#68)](https://github.com/gskbyte/GSKStretchyHeaderView/pull/68).\n\n## Configuration\n\nYou can change multiple parameters in your stretchy header view:\n\n```swift\n// you can change wether it expands at the top or as soon as you scroll down\nheaderView.expansionMode = .immediate\n\n// You can change the minimum and maximum content heights\nheaderView.minimumContentHeight = 64 // you can replace the navigation bar with a stretchy header view\nheaderView.maximumContentHeight = 280\n\n// You can specify if the content expands when the table view bounces, and if it shrinks if contentView.height \u003c maximumContentHeight. This is specially convenient if you use auto layout inside the stretchy header view\nheaderView.contentShrinks = true\nheaderView.contentExpands = false // useful if you want to display the refreshControl below the header view\n\n// You can specify wether the content view sticks to the top or the bottom of the header view if one of the previous properties is set to `false`\n// In this case, when the user bounces the scrollView, the content will keep its height and will stick to the bottom of the header view\nheaderView.contentAnchor = .bottom\n```\n\n## Creating your stretchy header\n\nThere are two ways to create your own stretchy header:\n\n- Create a stretchy header subclass and add subviews to its `contentView`. You can layout its subviews manipulating their frames or using Auto Layout (also works with [GranadaLayout](https://github.com/gskbyte/GranadaLayout) :trollface:).\n- Create an Interface Builder file and map it to your `GSKStretchyHeaderView` subclass. Subviews added to the stretchy header will be automatically moved to the content view, keeping their constraints. Remember to set the properties `maximumContentHeight` and `minimumContentHeight` in the attributes inspector (fourth tab on the right panel in Interface Builder).\n\nTo modify the behaviour and layout of your stretchy header, just override the method `-didChangeStretchFactor:` in your subclass, where you can adjust it by using the `stretchFactor`. To get a more detailed description of the properties, please have a look at the source code. There are also a few usage examples in the example project. You can also take them as a reference for your own stretchy headers.\n\n## Example project\n\nTo run the example project, clone the repo and open the workspace file `GSKStretchyHeaderView.xcworkspace`.\n\nYou can also use `pod try GSKStretchyHeaderView`.\n\n## Installation\n\nGSKStretchyHeaderView is available through [CocoaPods](http://cocoapods.org). To install it, simply add the following line to your Podfile, [you can check the Example Podfile to see how it looks like](https://github.com/gskbyte/GSKStretchyHeaderView/blob/master/Example/Podfile):\n\n```ruby\npod \"GSKStretchyHeaderView\"\n```\n\n\nGSKStretchyHeaderView is also available through [Carthage](). To install it, just add this line to your `Cartfile:\n```\ngithub \"gskbyte/GSKStretchyHeaderView\"\n```\nand run\n```bash\ncarthage update GSKStretchyHeaderView\n```\n\n## Author\n\n[Jose Alcalá Correa](https://twitter.com/gskbyte)\n\n## Contributions\n\nContributions are more than welcome! If you find a solution for a bug or have an improvement, don't hesitate to [open a pull request](https://github.com/gskbyte/GSKStretchyHeaderView/compare)!\n\n## License\n\n`GSKStretchyHeaderView` is available under the MIT license. See the LICENSE file for more info.\n\nIf your app uses `GSKStretchyHeaderView`, I'd be glad if you ping me via [Twitter](https://twitter.com/gskbyte) or via email.\n\n## [Changelog](https://github.com/gskbyte/GSKStretchyHeaderView/blob/master/CHANGELOG.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgskbyte%2FGSKStretchyHeaderView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgskbyte%2FGSKStretchyHeaderView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgskbyte%2FGSKStretchyHeaderView/lists"}