{"id":25195942,"url":"https://github.com/simplisticated/stylekit","last_synced_at":"2025-05-08T17:04:19.852Z","repository":{"id":56925035,"uuid":"74574606","full_name":"simplisticated/StyleKit","owner":"simplisticated","description":"CSS for iOS","archived":false,"fork":false,"pushed_at":"2016-11-29T01:11:48.000Z","size":68,"stargazers_count":60,"open_issues_count":0,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-08T17:04:01.178Z","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/simplisticated.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2016-11-23T12:28:23.000Z","updated_at":"2024-03-24T14:13:46.000Z","dependencies_parsed_at":"2022-08-20T22:50:26.013Z","dependency_job_id":null,"html_url":"https://github.com/simplisticated/StyleKit","commit_stats":null,"previous_names":["igormatyushkin014/stylekit"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplisticated%2FStyleKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplisticated%2FStyleKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplisticated%2FStyleKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplisticated%2FStyleKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simplisticated","download_url":"https://codeload.github.com/simplisticated/StyleKit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253112072,"owners_count":21856070,"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":[],"created_at":"2025-02-10T01:39:11.018Z","updated_at":"2025-05-08T17:04:19.825Z","avatar_url":"https://github.com/simplisticated.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\" \u003e\n\u003cimg src=\"https://github.com/igormatyushkin014/StyleKit/blob/master/Images/logo-1024-300.png\" alt=\"StyleKit\" title=\"StyleKit\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://swift.org\"\u003e\u003cimg src=\"https://img.shields.io/badge/Swift-3.0-orange.svg?style=flat\"\u003e\u003c/a\u003e\n\u003ca href=\"https://cocoapods.org\"\u003e\u003cimg src=\"https://img.shields.io/cocoapods/v/StyleKit.svg?maxAge=2592000\"\u003e\u003c/a\u003e\n\u003ca href=\"https://cocoapods.org\"\u003e\u003cimg src=\"https://img.shields.io/cocoapods/dt/StyleKit.svg?maxAge=2592000\"\u003e\u003c/a\u003e\n\u003ca href=\"https://tldrlegal.com/license/mit-license\"\u003e\u003cimg src=\"https://img.shields.io/badge/License-MIT-blue.svg?style=flat\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n# At a Glance\n\nFront-end developers, who create layout for HTML pages, know the simplicity and power of CSS classes. At some point I thought: why not to make something similar for native iOS apps? This idea was quite obvious. When the first version of the framework has been done, it was named `StyleKit`. Obvious name for obvious thing.\n\n# How To Get Started\n\n- Copy content of `Source` folder to your project.\n\nor\n\n- Use `UIStyle` cocoapod\n\n# Requirements\n\n* iOS 9.0 and later\n* Xcode 8 and later\n\n# Usage\n\nStyle is a set of UI attributes. Each style includes at least one attribute, but can include unlimited collection of attributes.\n\n```swift\n/*\n * Create simple style with one attribute.\n */\nlet attributes: [ViewStyleAttribute] = [\n    .backgroundColor(color: .yellow)\n]\n\nlet yellowBackground = ViewStyle(attributes: attributes)\n\n/*\n * Another way to create the same style.\n */\n\nlet anotherYellowBackground = ViewStyle.with(attribute: .backgroundColor(color: .yellow))\n    .done()\n\n/*\n * Create style with multiple attributes.\n */\n\nlet greenBackgroundWithThinRedBorder = ViewStyle.with(attribute: .backgroundColor(color: .green))\n    .and(attribute: .borderColor(color: .red))\n    .and(attribute: .borderWidth(width: 1.0))\n    .done()\n```\n\nFull list of attributes is available in [ViewStyleAttribute.swift](https://github.com/igormatyushkin014/StyleKit/blob/master/Source/Engine/ViewStyleAttribute.swift) file.\n\nAny style can be applied to any view. You can apply unlimited number of styles to the same view.\n\n```swift\n/*\n * Apply style to view.\n */\n\nview.stl.apply(style: yellowBackground)\n\n/*\n * Apply multiple styles to view.\n */\n\nview.stl.apply(style: yellowBackground)\n    .apply(style: greenBackgroundWithThinRedBorder)\n```\n\nRecommended way to manage styles in app is to implement a structure with static styles:\n\n```swift\nstruct StyleStorage {\n    \n    static let defaultBackground = ViewStyle.with(attribute: .backgroundColor(color: .white))\n        .and(attribute: .borderColor(color: .green))\n        .and(attribute: .borderWidth(width: 2.0))\n        .done()\n    \n    static let thinOrangeText = ViewStyle.with(attribute: .textColor(color: .orange))\n        .and(attribute: .font(font: UIFont.systemFont(ofSize: 36.0, weight: UIFontWeightThin)))\n        .done()\n        \n}\n```\n\nThose styles can be reused many times in different places of the app:\n\n```swift\noverride func viewDidLoad() {\n    super.viewDidLoad()\n    \n    /*\n     * Initialize view.\n     */\n    \n    view.stl.apply(style: StyleStorage.defaultBackground)\n    \n    /*\n     * Initialize title label.\n     */\n    \n    titleLabel.stl.apply(style: StyleStorage.thinOrangeText)\n}\n```\n\nAlso, it's possible to check programmatically if style supports view:\n\n```swift\nif StyleStorage.thinOrangeText.supports(view: helloLabel) {\n    helloLabel.stl.apply(style: StyleStorage.thinOrangeText)\n}\n```\n\n# License\n\n`StyleKit` is available under the MIT license. See the [LICENSE](./LICENSE) file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimplisticated%2Fstylekit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimplisticated%2Fstylekit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimplisticated%2Fstylekit/lists"}