{"id":15099649,"url":"https://github.com/pjechris/gaikan","last_synced_at":"2025-10-23T11:18:30.399Z","repository":{"id":35587227,"uuid":"39859973","full_name":"pjechris/Gaikan","owner":"pjechris","description":"Declarative view styling in Swift. Inspired by CSS modules.","archived":true,"fork":false,"pushed_at":"2017-09-15T09:20:30.000Z","size":1181,"stargazers_count":140,"open_issues_count":3,"forks_count":13,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-08-05T06:50:46.770Z","etag":null,"topics":["css","css-modules","swift","theme","ui","uikit"],"latest_commit_sha":null,"homepage":"","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/pjechris.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}},"created_at":"2015-07-28T22:03:29.000Z","updated_at":"2025-05-11T02:43:51.000Z","dependencies_parsed_at":"2022-09-18T01:30:43.183Z","dependency_job_id":null,"html_url":"https://github.com/pjechris/Gaikan","commit_stats":null,"previous_names":["akane/Gaikan","akane/gaikan","zerealjc/gaikan"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/pjechris/Gaikan","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjechris%2FGaikan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjechris%2FGaikan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjechris%2FGaikan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjechris%2FGaikan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pjechris","download_url":"https://codeload.github.com/pjechris/Gaikan/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjechris%2FGaikan/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278892100,"owners_count":26063928,"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-10-08T02:00:06.501Z","response_time":56,"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":["css","css-modules","swift","theme","ui","uikit"],"created_at":"2024-09-25T17:25:13.667Z","updated_at":"2025-10-08T05:31:00.706Z","avatar_url":"https://github.com/pjechris.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1\u003e\u003cimg src=\"Doc/Screen/logo.png\" width=\"550\" alt=\"Gaikan\" /\u003e\u003c/h1\u003e\n\n[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/Gaikan.svg)](https://img.shields.io/cocoapods/v/Gaikan.svg)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Build Status](https://travis-ci.org/akane/Gaikan.svg?branch=travis)](https://travis-ci.org/akane/Gaikan)\n\nGaikan gives you powerful styling capabilities using a declarative DSL in Swift.\n_Inspired by_ \u003ca href=\"https://speakerdeck.com/vjeux/react-css-in-js\"\u003eReact: CSS in JS\u003c/a\u003e and \u003ca href=\"http://glenmaddern.com/articles/css-modules\"\u003eCSS modules\u003c/a\u003e.\n\nTo style UIView(s) just give them a ```StyleRule``` object:\n\n```Swift\n\nlet myLabelStyle = StyleRule() { (inout style: StyleRule) -\u003e () in\n  style.color = UIColor.redColor()\n  style.border = Border(width: 1, color: UIColor.greenColor())\n  style.font = UIFont(name: \"Courier\", size: 24)\n}\n\nself.label.styleInline = myLabelStyle\n\n```\n\nCheck out the sample to see how to well integrate Gaikan into a project.\n\n\u003cimg src=\"Doc/Screen/gaikan.png\" width=\"400\" /\u003e\n\n## Features\n\n* Apply a simple style using ```styleInline```....\n* ... or make theming using ```styleClass``` (see below for more information).\n* You can share styles using ```extends``` method to avoid repeating yourself.\n* You can style depending on your control state (enabled, highlighted, ...).\n* You can style `NSAttributedString`!\n\n## Properties\n\nCheck out our page on [properties](Doc/Properties.md) to find which one to use to style your views.\n\nStarting with 0.4, we also added `VirtualView`. This allow you to apply style effects on some non `UIView`\nattributes/objects:\n\n| NSObject          | Virtual view  | Description            | Available since\n| ------------------|---------------|------------------------|------------------\n| UINavigationBar   | titleStyle    | Sets title navigation bar style   | 0.4\n\n## Advanced usage\n\n### NSAttributedString\n\nJust call `NSAttributedString(string:\"Hello\", style: yourStyle)` to get a  styled `NSAttributedString`.\n\nAlternatively you can use `style.textAttributes` to transform `StyleRule` into any `NSAttributedString` compatible dictionary.\n\n### Theme\n\n```Theme``` packages together multiple ```Style``` definitions to make a whole set.\n\n```Swift\n\npublic class SampleTheme : Theme {\n  /// Non static is important if you want to reference them from InterfaceBuilder\n  lazy let logo = Style(...)\n  lazy let title = Style(...)\n}\n\nclass CustomView: UIView {\n  typealias ThemeType = RailTheme\n\n  @IBOutlet weak var title: UILabel!\n  @IBOutlet weak var footnote: UILabel!\n  @IBOutlet weak var logo: UIImageView!\n  @IBOutlet weak var button: UIButton!\n\n  override func awakeFromNib() {\n    self.title.styleClass = SampleTheme().logo\n    self.logo.styleClass = SampleTheme().title\n  }\n}\n\n```\n\nYou can also apply themes right from InterfaceBuilder:\n\n\u003cimg src=\"Doc/Screen/ib-styleclass.png\" width=\"400\" /\u003e\n\n### Extends\n\nYou can extend your styles to reuse common features:\n\n```Swift\nfunc primary() -\u003e Style {\n  return [\n    .Color: UIColor.greenColor()\n  ]\n}\n\nfunc large() -\u003e Style {\n  return [\n    .Font: UIFont.systemFontOfSize(18)\n  ]\n}\n\nfunc merged() -\u003e Style {\n  return Style().extends(primary(), large())\n  // color: green, font: 18\n}\n\n```\n\n### States\n\nYou can define styles for states. They'll extend from the default state :\n\n```Swift\nfunc style() -\u003e Style {\n  return Style() { (inout style: StyleRule) -\u003e Void in\n    style.tintColor = UIColor.whiteColor()\n  }\n  .state(.Selected, attributes: [\n      .TintColor: UIColor.grayColor().colorWithAlphaComponent(0.6)\n  ]\n}\n```\n\nDon't hesitate to take a look at the sample to better understand how it works.\n\n## Contributing\n\nThis project was first developed by [Xebia IT Architects](http://xebia.fr) in Paris, France. We will continue working and investing on it.\n\nWe encourage the community to contribute to the project by opening tickets and/or pull requests. Here a some of the subjects we are interested in:\n\n- Add UIStackView attributes (distribution, spacing, ...).\n- Support for multiple layout engines (AutoLayout, LayoutKit, Flexbox, ...)\n- Allow to define 1+ borders and corner radius. Currently defining border and radius set the 4 of them (top, bottom, left, right).\n- Better support for IBDesignable (if possible).\n- Add debugging information (style name, inheritance, ...).\n- Better integration with NSAttributedString.\n- Support for traits.\n- Anything you have in mind!\n\n## License\n\nGaikan is released under the MIT License. Please see the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpjechris%2Fgaikan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpjechris%2Fgaikan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpjechris%2Fgaikan/lists"}