{"id":22710737,"url":"https://github.com/hooliooo/alacrity","last_synced_at":"2025-04-13T15:12:24.578Z","repository":{"id":56901693,"uuid":"94449085","full_name":"hooliooo/Alacrity","owner":"hooliooo","description":"Alacrity is a library that brings a fluent interface to UIView and its subclasses","archived":false,"fork":false,"pushed_at":"2019-04-05T07:43:33.000Z","size":139,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-13T15:12:19.254Z","etag":null,"topics":["fluent-interface","ios","swift","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/hooliooo.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":"2017-06-15T14:44:56.000Z","updated_at":"2019-04-05T07:43:35.000Z","dependencies_parsed_at":"2022-08-21T01:50:35.565Z","dependency_job_id":null,"html_url":"https://github.com/hooliooo/Alacrity","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hooliooo%2FAlacrity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hooliooo%2FAlacrity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hooliooo%2FAlacrity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hooliooo%2FAlacrity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hooliooo","download_url":"https://codeload.github.com/hooliooo/Alacrity/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248732488,"owners_count":21152852,"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":["fluent-interface","ios","swift","uikit"],"created_at":"2024-12-10T12:12:02.795Z","updated_at":"2025-04-13T15:12:24.557Z","avatar_url":"https://github.com/hooliooo.png","language":"Swift","readme":"# Alacrity\nAlacrity is a library that styles UIViews in a functional way.\n\n[![CI Status](http://img.shields.io/travis/hooliooo/Alacrity.svg?style=flat)](https://travis-ci.org/hooliooo/Alacrity)\n[![Version](https://img.shields.io/cocoapods/v/Alacrity.svg?style=flat)](http://cocoapods.org/pods/Alacrity)\n[![License](https://img.shields.io/cocoapods/l/Alacrity.svg?style=flat)](http://cocoapods.org/pods/Alacrity)\n[![Platform](https://img.shields.io/cocoapods/p/Alacrity.svg?style=flat)](http://cocoapods.org/pods/Alacrity)\n\n## Example\n\nWhen writing UI code programmatically we would typically write code such as this:\n\n```swift\nclass YourCustomView: UIView {\n    let aView: UIView = UIView()\n    let aLabel: UILabel = UILabel()\n\n    func setUpUI() {\n        // Customize aView\n        aView.backgroundColor = UIColor.red\n        aView.layer.cornerRadius = 5.0\n        aView.clipToBounds = true\n        \n        // Customize aLabel\n        aLabel.text = \"Your text\"\n        aLabel.font = UIFont.boldSystemFont(ofSize: 19.0)\n        aLabel.textAlignment = .center\n        aLabel.backgroundColor = .orange\n    }\n}\n```\n\nor\n\n```swift\nclass YourCustomView: UIView {\n    let aView: UIView = {\n        let view: UIView = UIView()\n        view.backgroundColor = UIColor.red\n        view.layer.cornerRadius = 5.0\n        view.clipToBounds = true\n        return view\n    }()\n\n    let aLabel: UILabel = {\n        let label: UILabel = UILabel()\n        label.text = \"Your text\"\n        label.font = UIFont.boldSystemFont(ofSize: 19.0)\n        label.textAlignment = .center\n        label.backgroundColor = .orange\n        return label\n    }()\n}\n```\n\nA lot of the time UIViews and its subclasses have similar styling in your projects. Alacrity makes it easy to style your subviews in a consistent way and get rid\nof duplicate code.\n\nWith Alacrity we can write something more succinct, without the boilerplate of typical programmatic UI code by taking advantage of closures\n\n```swift\n\n// In your styling file like AppUI.\n// Used an enum with no cases for the namespacing.\npublic enum AppUI {\n    \n    public static let defaultLabelStyle: AlacrityStyle\u003cUILabel\u003e = AlacrityStyle\u003cUILabel\u003e {\n        ... your styling logic here ...\n    }\n    \n    public static let defaultTextFieldStyle: AlacrityStyle\u003cUITextField\u003e = AlacrityStyle\u003cUITextField\u003e {\n        ... your styling logic here ...\n    }\n    \n    ... other styles ...\n\n}\n\nclass YourCustomView: UIView {\n    \n    let aView: UIView = UIView().avd.styled(with: AppUI.yourDefaultStyle)\n\n    let aLabel: UILabel = UILabel().avd.styled(with: AppUI.defaultLabelStyle)\n    \n}\n```\n\nWith the above pattern, you can make themes easily.\n\n## Requirements\nAlacrity requires iOS 9.3 or higher and Swift 5.x\n\n## Installation\n\n1. Add the following to your [Podfile](http://guides.cocoapods.org/using/the-podfile.html):\n\n```ruby\npod 'Alacrity'\n```\n2. Integrate your dependencies using frameworks: add `use_frameworks!` to your Podfile. \n3. Run `pod install`.\n\n## Author\n\nJulio Alorro\n\n## License\n\nAlacrity is available under the MIT license. See the LICENSE file for more info.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhooliooo%2Falacrity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhooliooo%2Falacrity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhooliooo%2Falacrity/lists"}