{"id":19319690,"url":"https://github.com/hyperoslo/brick","last_synced_at":"2025-08-22T18:14:13.634Z","repository":{"id":56903980,"uuid":"55419882","full_name":"hyperoslo/Brick","owner":"hyperoslo","description":":droplet: A generic view model for both basic and complex scenarios","archived":false,"fork":false,"pushed_at":"2017-01-13T09:09:34.000Z","size":382,"stargazers_count":59,"open_issues_count":0,"forks_count":3,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-08-19T14:51:36.014Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://hyper.no","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hyperoslo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-04T14:52:13.000Z","updated_at":"2024-05-10T05:40:10.000Z","dependencies_parsed_at":"2022-08-20T18:50:37.986Z","dependency_job_id":null,"html_url":"https://github.com/hyperoslo/Brick","commit_stats":null,"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"purl":"pkg:github/hyperoslo/Brick","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperoslo%2FBrick","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperoslo%2FBrick/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperoslo%2FBrick/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperoslo%2FBrick/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hyperoslo","download_url":"https://codeload.github.com/hyperoslo/Brick/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperoslo%2FBrick/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271680336,"owners_count":24802074,"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-22T02:00:08.480Z","response_time":65,"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-11-10T01:24:49.492Z","updated_at":"2025-08-22T18:14:13.609Z","avatar_url":"https://github.com/hyperoslo.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Brick\n\n[![CI Status](http://img.shields.io/travis/hyperoslo/Brick.svg?style=flat)](https://travis-ci.org/hyperoslo/Brick)\n[![Version](https://img.shields.io/cocoapods/v/Brick.svg?style=flat)](http://cocoadocs.org/docsets/Brick)\n[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![License](https://img.shields.io/cocoapods/l/Brick.svg?style=flat)](http://cocoadocs.org/docsets/Brick)\n[![Platform](https://img.shields.io/cocoapods/p/Brick.svg?style=flat)](http://cocoadocs.org/docsets/Brick)\n[![Documentation](https://img.shields.io/cocoapods/metrics/doc-percent/Brick.svg?style=flat)](http://cocoadocs.org/docsets/Brick)\n![Swift](https://img.shields.io/badge/%20in-swift%203.0-orange.svg)\n\n## Description\n\n\u003cimg src=\"https://raw.githubusercontent.com/hyperoslo/Brick/master/Images/icon_v2.png\" alt=\"Brick Icon\" align=\"right\" /\u003e\n\nBrick is a generic view model for both basic and complex scenarios.\nMapping a basic table view cells is as easy as pie, if you have more properties, you can use the `meta` dictionary to add all additional properties that you might need. It also supports relations so that you can nest view models inside of view models.\n\n```swift\npublic struct Item: Mappable {\n  public var index = 0\n  public var title = \"\"\n  public var subtitle = \"\"\n  public var text = \"\"\n  public var image = \"\"\n  public var kind = \"\"\n  public var action: String?\n  public var size = CGSize(width: 0, height: 0)\n  public var meta = [String : AnyObject]()\n}\n```\n\n- **.index**\nCalculated value to determine the index it has inside of the component.\n- **.title**\nThe headline for your data, in a `UITableViewCell` it is normally used for `textLabel.text` but you are free to use it as you like.\n- **.subtitle**\nSame as for the title, in a `UITableViewCell` it is normally used for `detailTextLabel.text`.\n- **.text**\nThis is an optional property that can be used for larger amount of text needed to describe your `Item`\n- **.image**\nCan be either a URL string or a local string, you can easily determine if it should use a local or remote asset in your view.\n- **.kind**\nIs used for the `reuseIdentifier` of your `UITableViewCell` or `UICollectionViewCell`.\n- **.action**\nAction identifier for you to parse and process when a user taps on a list item. We recommend [Compass](https://github.com/hyperoslo/Compass) as centralized navigation system.\n- **.size**\nCan either inherit from the `UITableViewCell`/`UICollectionViewCell`, or be manually set by the height calculations inside of your view.\n- **.meta**\nThis is used for extra data that you might need access to inside of your view, it can be a hex color, a unique identifer or additional images for your view.\n\n## Usage\n\n```swift\nlet item = Item(\n  title: \"John Hyperseed\",\n  subtitle: \"Build machine\",\n  meta: [\n    \"operatingSystem\" : \"OS X\",\n    \"xcodeVersion\" : 7.3\n])\n\nprint(item.meta(\"operatingSystem\", \"\")) // prints \"OS X\"\nprint(item.meta(\"xcodeVersion\", 0.0)) // prints 7.3\n\n```\n\n## Installation\n\n**Brick** is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'Brick'\n```\n\n**Brick** is also available through [Carthage](https://github.com/Carthage/Carthage).\nTo install just write into your Cartfile:\n\n```ruby\ngithub \"hyperoslo/Brick\"\n```\n\n## Author\n\nHyper Interaktiv AS, ios@hyper.no\n\n## Contributing\n\nWe would love you to contribute to **Brick**, check the [CONTRIBUTING](https://github.com/hyperoslo/Brick/blob/master/CONTRIBUTING.md) file for more info.\n\n## License\n\n**Brick** is available under the MIT license. See the [LICENSE](https://github.com/hyperoslo/Brick/blob/master/LICENSE.md) file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperoslo%2Fbrick","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhyperoslo%2Fbrick","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperoslo%2Fbrick/lists"}