{"id":13503930,"url":"https://github.com/spotify/HubFramework","last_synced_at":"2025-03-29T18:31:37.398Z","repository":{"id":52239960,"uuid":"69279243","full_name":"spotify/HubFramework","owner":"spotify","description":"DEPRECATED – Spotify’s component-driven UI framework for iOS","archived":true,"fork":false,"pushed_at":"2018-11-06T10:34:05.000Z","size":148010,"stargazers_count":1861,"open_issues_count":11,"forks_count":143,"subscribers_count":63,"default_branch":"master","last_synced_at":"2025-03-28T05:11:09.493Z","etag":null,"topics":["component-driven","hub-framework","ios","spotify","ui"],"latest_commit_sha":null,"homepage":"https://spotify.github.io/HubFramework","language":"Objective-C","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spotify.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-09-26T18:19:58.000Z","updated_at":"2024-12-19T11:16:31.000Z","dependencies_parsed_at":"2022-08-21T02:51:01.318Z","dependency_job_id":null,"html_url":"https://github.com/spotify/HubFramework","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spotify%2FHubFramework","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spotify%2FHubFramework/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spotify%2FHubFramework/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spotify%2FHubFramework/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spotify","download_url":"https://codeload.github.com/spotify/HubFramework/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246227095,"owners_count":20743884,"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":["component-driven","hub-framework","ios","spotify","ui"],"created_at":"2024-07-31T23:00:49.992Z","updated_at":"2025-03-29T18:31:32.998Z","avatar_url":"https://github.com/spotify.png","language":"Objective-C","readme":"\u003cimg alt=\"The Hub Framework\" src=\"readme-banner.jpg\" width=\"100%\" max-width=1008\u003e\n\n[![Build Status](https://travis-ci.org/spotify/HubFramework.svg?branch=master)](https://travis-ci.org/spotify/HubFramework/branches)\n[![Coverage Status](https://codecov.io/github/spotify/HubFramework/coverage.svg?branch=master)](https://codecov.io/github/spotify/HubFramework?branch=master)\n[![Documentation website](https://img.shields.io/badge/Documentation-website-blue.svg)](https://spotify.github.io/HubFramework)\n[![Spotify FOSS Slack](https://slackin.spotify.com/badge.svg)](https://slackin.spotify.com)\n\n## Deprecated\n\nThe Hub Framework is being phased out at Spotify, and therefore we will not be maintaining it further.\n\n---\n\nWelcome to the Hub Framework - a toolkit for building native, component-driven UIs on iOS. It is designed to enable teams of any size to quickly build, tweak and ship new UI features, in either new or existing apps. It also makes it easy to build backend-driven UIs.\n\nThe Hub Framework has two core concepts - **Components** \u0026 **Content Operations**.\n\n## Components\n\nInstead of building `UIViewControllers` that each have hard-wired behaviors for UI in terms of controls, data binding \u0026 selection handling - a Hub Framework-powered UI is all about components.\n\nComponents can be reused and rearranged in any way, and render any model. They each define a rectangle on the screen in which anything can be rendered, making it easy to quickly iterate on UI and creating modular building blocks that reduce the need for code duplication.\n\nThe good news is that you don't have to rewrite your existing `UIViews` to start using the Hub Framework, instead, the architecture of the framework is completely protocol oriented, making it easy to add compatibility to existing UI.\n\nTo learn more about components, check out the [Component programming guide](https://spotify.github.io/HubFramework/component-programming-guide.html).\n\n## Content Operations\n\nTo match the highly dynamic component-driven UIs, content operations define what content to render in a declarative fashion. Content can either be defined in code, running locally in the application, or through JSON that is provided by a backend system. This enables you to easily aggregate data from multiple sources, and to change your UI and its content directly from the backend.\n\nEach feature of an application can define its own content operations, and put them together to form a **content loading chain**. Each operation can perform an atomic mutation of the UI state, enabling easy implementation of things like A/B testing or providing system-wide functionality like caching or loading indicators.\n\nTo learn more about content operations, check out the [Content programming guide](https://spotify.github.io/HubFramework/content-programming-guide.html).\n\n## Background story\n\nSo, why did we build this? At Spotify, we love to experiment with our UI, to present content in new exciting ways - and to continue to learn what works and what doesn't.\n\nHowever, the traditional way of building and shipping UIs on iOS was slowing us down. Always having to write `UIViewControllers` from scratch, hard-wiring behaviors and tying specific models to specific views lead to slow iteration times and a lot of duplicate work.\n\nSo, we did what we always do - we started experimenting. The Hub Framework is the result of those experiments. We realized that by building our UIs as *\"hubs of content\"* using components as building blocks, and by fully decoupling our model code from our UI using content operations - our app became a lot more dynamic and easier to work with. What's more, by letting our backend JSON data contain additional metadata and fully localized strings, we could render responses directly. Instead of having to do lots of custom mapping and transforms in all views.\n\nThe result is that we are now free to experiment and try out new UI ideas quicker than ever - all while having a lot less code to maintain. By sharing the Hub Framework with you - the open source community - we hope that more apps and teams can benefit from using this type of architecture.\n\n## How does Spotify use this?\n\nThis framework is used in production in the Spotify iOS app, which is used by many millions of users every day. We use it to build views like Browse, Running, Party, Genre Pages and more. Important to note is also that we don't keep an internal mirror of this repo - all development on the Hub Framework is done in the open.\n\n## Compatibility\n\nThe Hub Framework is compatible with **iOS 8 or later**, and can be used from either Objective-C or Swift. In Swift, the API has been annotated to feel Swift-native, with proper nullability and API refinements for Swift 3.\n\nWhile the framework itself is written entirely in Objective-C, the [demo app](https://github.com/spotify/HubFramework/tree/master/demo) is written in Swift 3.\n\n## Installation\n\nYou can choose to install the Hub Framework either manually, or through a dependency manager.\n\n#### Manually\n\n- Clone this repo (for example, add it as a submodule).\n- Drag the project `HubFramework.xcproj` into Xcode as a subproject of your app project.\n- Link with `HubFramework` by adding it in \"Linked Frameworks and Libaries\", under the \"General\" tab in your app's project settings.\n\n#### Using CocoaPods\n\n*To use CocoaPods, first make sure you have installed it and updated it to the latest version by following their instructions on [cocoapods.org](https://cocoapods.org)*\n\nAdd `HubFramework` to your `Podfile`:\n\n```\npod 'HubFramework'\n```\n\nUpdate your pods:\n\n```\n$ pod update\n```\n\n#### Using Carthage\n\n*To use Carthage, first make sure you have installed it and updated it to the latest version by following their instructions on [their repo](https://github.com/Carthage/Carthage)*\n\nFirst, add `HubFramework` to your `Cartfile`:\n\n```\ngithub \"spotify/HubFramework\" ~\u003e 2.0\n```\n\nThen, run Carthage:\n\n```\n$ carthage update\n```\n\n#### Link with `SystemConfiguration`\n\nOnce you've installed the Hub Framework, link your app with Apple's `SystemConfiguration` framework. This is done by adding it in \"Linked Frameworks and Libaries\", under the \"General\" tab in your app's project settings. This framework is used to determine the connectivity state of an app using the Hub Framework.\n\n## Importing the framework\n\nIn Objective-C:\n\n```objective-c\n#import \u003cHubFramework/HubFramework.h\u003e\n```\n\nIn Swift:\n\n```swift\nimport HubFramework\n```\n\n## Getting started\n\nTo enable you to quickly get started using the Hub Framework, we've created a [**setup guide**](https://spotify.github.io/HubFramework/setup-guide.html) that walks you through how to set it up in an application, as well as a [**getting started guide**](https://spotify.github.io/HubFramework/getting-started-guide.html) that will give you a step-by-step tutorial to building your first view using it.\n\nThere are also a series of **programming guides** that each introduce you to different aspects of the framework.\n\n- [Component programming guide](https://spotify.github.io/HubFramework/component-programming-guide.html)\n- [Content programming guide](https://spotify.github.io/HubFramework/content-programming-guide.html)\n- [Layout programming guide](https://spotify.github.io/HubFramework/layout-programming-guide.html)\n- [JSON programming guide](https://spotify.github.io/HubFramework/json-programming-guide.html)\n- [Action programming guide](https://spotify.github.io/HubFramework/action-programming-guide.html)\n\n## Hub Framework Sessions\n\nTo make it easier for you to learn some of the core concepts of the framework, we've started creating a series of YouTube videos that each explain one of those concepts. They're called \"Hub Framework Sessions\" and can be found here:\n\n- [Episode 1: Content Loading Chain](https://youtu.be/XbMFPtxk_4Q)\n- [Episode 2: Creating Components](https://youtu.be/JpeQhKAen8M)\n\n## Demo app\n\nTo see an example implementation of the Hub Framework, open up the [demo app](https://github.com/spotify/HubFramework/tree/master/demo) that has a few different features, showcasing some of the capabilities of the framework.\n\n## Documentation\n\nThe Hub Framework’s API is well documented and we generate both a [documentation website](https://spotify.github.io/HubFramework/) as well as a DocSet for the documentation app [Dash](https://kapeli.com/dash). The documentation is also written in such a way that Xcode will present it on usage.\n\nThe Dash documentation is updated automatically for you on any changes to the framework. Get it by subscribing to the [https://spotify.github.io/HubFramework/docsets/HubFramework.xml](dash-feed://https%3A%2F%2Fspotify%2Egithub%2Eio%2FHubFramework%2Fdocsets%2FHubFramework%2Exml) feed.\n\n## Live editing\n\nSince the Hub Framework enables UIs to be defined using JSON data, it also enables you to quickly build or prototype UIs using a local JSON file. It includes a command line tool (`hublive`) that, when run, enables you to see changes you make in that local JSON file rendered live in your application. For more information about how to use live editing, see the [Live editing guide](https://spotify.github.io/HubFramework/live-editing-guide.html)\n\n## Xcode file templates\n\nThe Hub Framework contains a set of Xcode file templates that make it easy to create the boilerplate for components, content operations, etc.\n\nTo install them, simply copy the `Hub Framework` folder located in `templates/xcode` to `~/Library/Developer/Xcode/Templates/File Templates` (You may need to create the last two folders in that path).\n\n## Help \u0026 Bug Reporting\n\nIn case you need help or want to report a bug - please [file an issue](https://github.com/spotify/HubFramework/issues/new). Make sure to provide us with as much debuggable information as you can, like iOS version used and any reproduction steps. Sample code also makes it a lot easier for us to help you.\n\nYou can also chat with the team behind the Hub Framework directly! The Spotify FOSS community has a [Slack Group](https://slackin.spotify.com/) that you can join. Once you've joined, head over to the `hubframework` channel to chat with us!\n\n## Contributing\n\nAnyone is more than welcome to contribute to the Hub Framework! Together we can make the framework even more capable, and help each other fix any issues that we might find. However, before you contribute, please read [our contribution guidlines](CONTRIBUTING.md).\n\n## Authors\n\nThe Hub Framework was built at [Spotify](www.spotify.com) by [John Sundell](https://twitter.com/johnsundell), [Aron Cedercrantz](https://twitter.com/rastersize), [Robin Goos](https://github.com/Goos) and [several others](https://github.com/spotify/HubFramework/graphs/contributors).\n","funding_links":[],"categories":["UI","Uncategorized","Objective-C  Stars 1000以内排名整理","Objective-C","HarmonyOS"],"sub_categories":["Uncategorized","Windows Manager"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspotify%2FHubFramework","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspotify%2FHubFramework","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspotify%2FHubFramework/lists"}