{"id":2228,"url":"https://github.com/shindyu/ApplyStyleKit","last_synced_at":"2025-08-06T16:31:56.462Z","repository":{"id":56902358,"uuid":"161801342","full_name":"shindyu/ApplyStyleKit","owner":"shindyu","description":"Elegant Apply Style by Swift Method Chain.🌙","archived":false,"fork":false,"pushed_at":"2022-11-09T12:52:31.000Z","size":137,"stargazers_count":208,"open_issues_count":3,"forks_count":17,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-11-11T04:59:39.131Z","etag":null,"topics":["methodchain","swift","useful"],"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/shindyu.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":"2018-12-14T15:09:40.000Z","updated_at":"2023-10-12T14:25:30.000Z","dependencies_parsed_at":"2022-08-21T01:50:45.805Z","dependency_job_id":null,"html_url":"https://github.com/shindyu/ApplyStyleKit","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shindyu%2FApplyStyleKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shindyu%2FApplyStyleKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shindyu%2FApplyStyleKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shindyu%2FApplyStyleKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shindyu","download_url":"https://codeload.github.com/shindyu/ApplyStyleKit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228923736,"owners_count":17992570,"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":["methodchain","swift","useful"],"created_at":"2024-01-05T20:16:08.251Z","updated_at":"2024-12-09T16:31:15.290Z","avatar_url":"https://github.com/shindyu.png","language":"Swift","funding_links":[],"categories":["Libs","UI","Utility [🔝](#readme)"],"sub_categories":["Utility","Font","Other Testing"],"readme":"\u003cdiv align=\"center\" \u003e\n  \u003cimg width=\"70%\" src=\"image/logo.png\" /\u003e\n\u003c/div\u003e\n\n# ApplyStyleKit\n[![Build Status](https://app.bitrise.io/app/9d318dc7bad1f48a/status.svg?token=802LajjAXiwN4qC3-HgtVA\u0026branch=master)](https://app.bitrise.io/app/9d318dc7bad1f48a)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-brightgreen.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Cocoapods Compatible](https://img.shields.io/cocoapods/v/ApplyStyleKit.svg?style=flat)](https://cocoapods.org/pods/ApplyStyleKit)\n[![License](https://img.shields.io/cocoapods/l/ApplyStyleKit.svg?style=flat)](http://cocoapods.org/pods/ApplyStyleKit)\n[![Platform](https://img.shields.io/cocoapods/p/ApplyStyleKit.svg?style=flat)](http://cocoapods.org/pods/ApplyStyleKit)\n\nApplyStyleKit is a library that applies styles to UIKit using Swifty Method Chain.\n\nNormally, when applying styles to UIView etc.,it is necessary to write propertyName and equal operator many times.\n\nWith ApplyStyleKit, you can comfortably apply style to your code.\n\nLike this:\n```swift\n    sampleLabel.applyStyle\n        .backgroundColor(.yellow)\n        .text(\"sample label\")\n        .textAlignment(.center)\n        .textColor(.green)\n        .font(.boldSystemFont(ofSize: 30.0))\n        .numberOfLines(0)\n```\n\n## Installation\n### Requirements\n- iOS 9.0 or later\n- Swift 4.2\n- Xcode 10\n\n### Carthage\n```\n  github \"shindyu/ApplyStyleKit\"\n```\n\n### CocoaPods\n```\ntarget '\u003cYour Target Name\u003e' do\n  pod 'ApplyStyleKit'\nend\n```\n\n## Usage\n\n```swift\nimport ApplyStyleKit\n\nclass ViewController: UIViewController {\n    let sampleView = UIView()\n    let sampleLabel = CustomLabel()\n\n    override func viewDidLoad() {\n        super.viewDidLoad()\n        \n        // Apply style\n        sampleView.applyStyle\n            .backgroundColor(.red)\n            .alpha(0.5)\n\n        // When applying to layer\n        sampleView.layer.applyStyle\n            .cornerRadius(10)\n            .borderColor(.gray)\n            .borderWidth(2)\n\n        // Of course, you can apply it if you inherit UIView etc.\n        sampleLabel.applyStyle\n            .text(\"Of course, you can apply it if you inherit UIView etc.\")\n            .textAlignment(.center)\n            .textColor(.green)\n            .font(.boldSystemFont(ofSize: 30.0))\n            .numberOfLines(0)\n    }\n}\n```\n\n### Advanced\nYou can also create your own applyStyleMethod.\n\nTo be able to define the extension, the access modifier of `base` which is a property of `StyleObject` is public.\n\nexample:\n```swift\nextension StyleObject where Base: UIView {\n    @discardableResult func specialStyle() -\u003e StyleObject {\n        base.backgroundColor = .red\n        base.layer.cornerRadius = 10\n        return self\n    }\n}\n```\n\n## Support\nQuartzCore\n- ✅ CALayer\n\nUIKit\n- ✅ UIView\n- ✅ UILabel\n- ✅ UIButton\n- ✅ UIImageView\n- ✅ UISwitch\n- ✅ UIControl\n- ✅ UIStackView\n- ✅ UISlider\n- ✅ UITableView\n- ✅ UICollectionView\n\n## Basic policy\nApplyStyleKit intends to target methods with no return value and properties with setter.\nDue to the nature of ApplyStyleKit, I think that returning types other than StyleObject should be avoided.\n \n## Contributing\nPlease make an issue or pull request if you have any request.\n\nBug reports, Documentation, or tests, are always welcome as well!😂\n\n## License\nApplyStyleKit is available as open source under the terms of the [MIT](https://github.com/shindyu/ApplyStyleKit/blob/master/LICENSE) License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshindyu%2FApplyStyleKit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshindyu%2FApplyStyleKit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshindyu%2FApplyStyleKit/lists"}