{"id":2665,"url":"https://github.com/andreamazz/AMScrollingNavbar","last_synced_at":"2025-08-06T14:33:00.057Z","repository":{"id":41247838,"uuid":"14238862","full_name":"andreamazz/AMScrollingNavbar","owner":"andreamazz","description":"Scrollable UINavigationBar that follows the scrolling of a UIScrollView","archived":false,"fork":false,"pushed_at":"2023-04-13T02:27:58.000Z","size":23499,"stargazers_count":6041,"open_issues_count":39,"forks_count":636,"subscribers_count":130,"default_branch":"master","last_synced_at":"2025-08-01T21:30:12.824Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/andreamazz.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":"andreamazz"}},"created_at":"2013-11-08T16:56:39.000Z","updated_at":"2025-07-28T13:49:36.000Z","dependencies_parsed_at":"2023-10-20T17:07:25.341Z","dependency_job_id":"a9561566-4904-4bf7-a8e7-045648f1ee5d","html_url":"https://github.com/andreamazz/AMScrollingNavbar","commit_stats":{"total_commits":553,"total_committers":52,"mean_commits":"10.634615384615385","dds":0.1880650994575045,"last_synced_commit":"5016bc166af5cd08676fed5d762e00e6333a88ac"},"previous_names":[],"tags_count":109,"template":false,"template_full_name":null,"purl":"pkg:github/andreamazz/AMScrollingNavbar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreamazz%2FAMScrollingNavbar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreamazz%2FAMScrollingNavbar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreamazz%2FAMScrollingNavbar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreamazz%2FAMScrollingNavbar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andreamazz","download_url":"https://codeload.github.com/andreamazz/AMScrollingNavbar/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreamazz%2FAMScrollingNavbar/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269090186,"owners_count":24358216,"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-06T02:00:09.910Z","response_time":99,"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":[],"created_at":"2024-01-05T20:16:19.630Z","updated_at":"2025-08-06T14:32:59.624Z","avatar_url":"https://github.com/andreamazz.png","language":"Swift","readme":"\u003cp align=\"center\"\u003e\n  \u003cimg width=\"420\" height=\"240\" src=\"assets/logo.png\"/\u003e\n\u003c/p\u003e\n\n[![CocoaPods](https://cocoapod-badges.herokuapp.com/v/AMScrollingNavbar/badge.svg)](http://www.cocoapods.org/?q=amscrollingnavbar)\n![Build status](https://github.com/andreamazz/AMScrollingNavbar/workflows/Test%20suite/badge.svg)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n![Swift 5](https://img.shields.io/badge/swift-5-orange.svg)\n[![Join the chat at https://gitter.im/andreamazz/AMScrollingNavbar](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/andreamazz/AMScrollingNavbar?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=46FNZD4PDVNRU)\n\nA custom UINavigationController that enables the scrolling of the navigation bar alongside the\nscrolling of an observed content view  \n\n\u003cp align=\"center\"\u003e\n  \u003ca href='https://appetize.io/app/0u5wbe5vfputft397xktrk1hb8?device=iphonexs\u0026scale=75\u0026orientation=portrait\u0026osVersion=12.4' alt='Live demo'\u003e\n    \u003cimg width=\"150\" height=\"75\" src=\"assets/demo-button.png\"/\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n### Versioning notes\n\n- Version `2.x` is written as a subclass of `UINavigationController`, in Swift.  \n- Version `2.0.0` introduced Swift 2.0 syntax.\n- Version `3.0.0` introduced Swift 3.0 syntax.\n- Version `4.0.0` introduced Swift 4.0 syntax.\n- Version `5.1.0` introduced Swift 4.2 syntax.\n\nIf you are looking for the category implementation in Objective-C, make sure to checkout version `1.x` and prior, although the `2.x` is recomended.\n\n# Screenshot\n\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"520\" height=\"536\" src=\"assets/screenshot.gif\"/\u003e\n\u003c/p\u003e\n\n# Setup with CocoaPods\n\n```\npod 'AMScrollingNavbar'\n\nuse_frameworks!\n```\n\n# Setup with Carthage\n\n```\ngithub \"andreamazz/AMScrollingNavbar\"\n```\n\n## Usage\n\nMake sure to use `ScrollingNavigationController` instead of the standard `UINavigationController`. Either set the class of your `UINavigationController` in your storyboard, or create programmatically a `ScrollingNavigationController` instance in your code.\n\nUse `followScrollView(_: delay:)` to start following the scrolling of a scrollable view (e.g.: a `UIScrollView` or `UITableView`).\n#### Swift\n```swift\noverride func viewWillAppear(_ animated: Bool) {\n    super.viewWillAppear(animated)\n\n    if let navigationController = navigationController as? ScrollingNavigationController {\n        navigationController.followScrollView(tableView, delay: 50.0)\n    }\n}\n```\n\n#### Objective-C\n```objc\n- (void)viewWillAppear:(BOOL)animated {\n    [super viewWillAppear:animated];\n\n    [(ScrollingNavigationController *)self.navigationController followScrollView:self.tableView delay:0 scrollSpeedFactor:1 collapseDirection:NavigationBarCollapseDirectionScrollDown followers:nil];\n}\n```\n\nUse `stopFollowingScrollview()` to stop the behaviour. Remember to call this function on disappear:\n```swift\noverride func viewDidDisappear(_ animated: Bool) {\n    super.viewDidDisappear(animated)\n\n    if let navigationController = navigationController as? ScrollingNavigationController {\n        navigationController.stopFollowingScrollView()\n    }\n}\n```\n\n## ScrollingNavigationViewController\nTo DRY things up you can let your view controller subclass `ScrollingNavigationViewController`, which provides the base setup implementation. You will just need to call `followScrollView(_: delay:)`:\n```swift\noverride func viewWillAppear(_ animated: Bool) {\n    super.viewWillAppear(animated)\n\n    if let navigationController = navigationController as? ScrollingNavigationController {\n        navigationController.followScrollView(tableView, delay: 50.0)\n    }\n}\n```\n\n## Followers\nTo move another view, like a toolbar, alongside the navigation bar you can provide the view or multiple views as the `followers` parameter. Since you might want to have the follower up or down, you'll have to specify the scroll direction of the view once it starts to follow the navigation bar:\n```swift\nif let navigationController = navigationController as? ScrollingNavigationController {\n    navigationController.followScrollView(tableView, delay: 50.0, followers: [NavigationBarFollower(view: customFooter, direction: .scrollDown)])\n}\n```\n\nNote that when navigating away from the controller the followers might keep the scroll offset. Refer to [Handling navigation](https://github.com/andreamazz/AMScrollingNavbar#handling-navigation) for proper setup.  \n\n## Additional scroll\n\nIf you want to furhter scroll the navigation bar out of the way, you can use the optional parameter `additionalOffset` in the `followScrollView` call.\n\n## Scrolling the TabBar\nYou can also pass a `UITabBar` in the `followers` array:\n```swift\nif let navigationController = navigationController as? ScrollingNavigationController {\n    navigationController.followScrollView(tableView, delay: 50.0, followers: [tabBarController.tabBar])\n}\n```\n\n\n## ScrollingNavigationControllerDelegate\nYou can set a delegate to receive a call when the state of the navigation bar changes:\n```swift\nif let navigationController = navigationController as? ScrollingNavigationController {\n    navigationController.scrollingNavbarDelegate = self\n}\n```\n\nDelegate function:\n```swift\nfunc scrollingNavigationController(_ controller: ScrollingNavigationController, didChangeState state: NavigationBarState) {\n    switch state {\n    case .collapsed:\n        print(\"navbar collapsed\")\n    case .expanded:\n        print(\"navbar expanded\")\n    case .scrolling:\n        print(\"navbar is moving\")\n    }\n}\n```\n\n## Handling navigation\nIf the view controller with the scroll view pushes new controllers, you should call `showNavbar(animated:)` in your `viewWillDisappear(animated:)`:\n```swift\noverride func viewWillDisappear(_ animated: Bool) {\n    super.viewWillDisappear(animated)\n    if let navigationController = navigationController as? ScrollingNavigationController {\n      navigationController.showNavbar(animated: true)\n    }\n}\n```\n\n## Scrolling to top\nWhen the user taps the status bar, by default a scrollable view scrolls to the top of its content. If you want to also show the navigation bar, make sure to include this in your controller:\n\n```swift\nfunc scrollViewShouldScrollToTop(_ scrollView: UIScrollView) -\u003e Bool {\n    if let navigationController = navigationController as? ScrollingNavigationController {\n        navigationController.showNavbar(animated: true, scrollToTop: true)\n    }\n    return true\n}\n```\n\n## Scroll speed\nYou can control the speed of the scrolling using the `scrollSpeedFactor` optional parameter:\n\n```swift\ncontroller.followScrollView(view, delay: 0, scrollSpeedFactor: 2)\n```\n\nCheck out the sample project for more details.\n\n## Changing UINavigationBar.tintColor\nAMScrollingNavBar maintains its own copy of the UINavigationBar's `tintColor` property. You need to notify the AMScrollingNavBar of a tint change by calling `navBarTintUpdated()`:\n\n```swift\nnavigationBar.tintColor = UIColor.red\ncontroller.navBarTintUpdated()\n```\n\nCheck out the sample project for more details.\n\n# Author\n[Andrea Mazzini](https://twitter.com/theandreamazz). I'm available for freelance work, feel free to contact me.\n\nWant to support the development of [these free libraries](https://cocoapods.org/owners/734)? Buy me a coffee ☕️ via [Paypal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=46FNZD4PDVNRU).  \n\n# Contributors\n[Syo Ikeda](https://github.com/ikesyo) and [everyone](https://github.com/andreamazz/AMScrollingNavbar/graphs/contributors) kind enough to submit a pull request.\n\n# MIT License\n    The MIT License (MIT)\n\n    Copyright (c) 2014-2019 Andrea Mazzini\n\n    Permission is hereby granted, free of charge, to any person obtaining a copy of\n    this software and associated documentation files (the \"Software\"), to deal in\n    the Software without restriction, including without limitation the rights to\n    use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n    the Software, and to permit persons to whom the Software is furnished to do so,\n    subject to the following conditions:\n\n    The above copyright notice and this permission notice shall be included in all\n    copies or substantial portions of the Software.\n\n    THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n    FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n    COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n    IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n    CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","funding_links":["https://github.com/sponsors/andreamazz","https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=46FNZD4PDVNRU"],"categories":["UI","Libs","Bar","Swift","\u003ca name=\"for-projects\"\u003e\u003c/a\u003e For Projects","UI [🔝](#readme)","etc","ALL"],"sub_categories":["Navigation Bar","UI","Layout","Other free courses","\u003ca name=\"for-projects-example-projects\"\u003e\u003c/a\u003e Example Projects"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreamazz%2FAMScrollingNavbar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreamazz%2FAMScrollingNavbar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreamazz%2FAMScrollingNavbar/lists"}