{"id":17690240,"url":"https://github.com/onmyway133/construction","last_synced_at":"2025-05-12T13:47:01.259Z","repository":{"id":56906505,"uuid":"48781851","full_name":"onmyway133/Construction","owner":"onmyway133","description":":construction_worker: The many ways to construct and configure your entity","archived":false,"fork":false,"pushed_at":"2016-04-28T21:08:52.000Z","size":433,"stargazers_count":33,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-11T21:03:22.023Z","etag":null,"topics":["construction","constructor","init","ios","swift"],"latest_commit_sha":null,"homepage":"","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/onmyway133.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2015-12-30T04:29:58.000Z","updated_at":"2025-02-18T14:08:04.000Z","dependencies_parsed_at":"2022-08-21T03:50:13.454Z","dependency_job_id":null,"html_url":"https://github.com/onmyway133/Construction","commit_stats":null,"previous_names":["onmyway133/configurable"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onmyway133%2FConstruction","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onmyway133%2FConstruction/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onmyway133%2FConstruction/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onmyway133%2FConstruction/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/onmyway133","download_url":"https://codeload.github.com/onmyway133/Construction/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253750395,"owners_count":21958290,"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":["construction","constructor","init","ios","swift"],"created_at":"2024-10-24T11:50:20.755Z","updated_at":"2025-05-12T13:47:01.225Z","avatar_url":"https://github.com/onmyway133.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Construction\n\nThe many ways to construct and configure your entity. Work for struct and class\n\n[![CI Status](http://img.shields.io/travis/onmyway133/Construction.svg?style=flat)](https://travis-ci.org/onmyway133/Construction)\n[![Version](https://img.shields.io/cocoapods/v/Construction.svg?style=flat)](http://cocoadocs.org/docsets/Construction)\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/Construction.svg?style=flat)](http://cocoadocs.org/docsets/Construction)\n[![Platform](https://img.shields.io/cocoapods/p/Construction.svg?style=flat)](http://cocoadocs.org/docsets/Construction)\n\n![](Screenshots/Banner.png)\n\n## Usage\n\n### construct\n\n- Free function\n- Construct a struct and configure it\n\n`Person`\n```swift\nstruct Person {\n  var name: String = \"\"\n  var age: Int = 0\n  var website: NSURL?\n\n  init() {\n\n  }\n}\n\nextension Person: Initable {}\n```\n\n```swift\nlet person: Person = construct {\n  $0.name = \"Luffy\"\n  $0.age = 17\n}\n\nXCTAssertEqual(person.name, \"Luffy\")\nXCTAssertEqual(person.age, 17)\nXCTAssertNil(person.website)\n```\n\n### build\n\n- Free function\n- Build an existing struct\n\n```swift\nvar person = Person() // Declare as `var`\nbuild(\u0026person) {      // Use `\u0026`\n  $0.name = \"Luffy\"\n  $0.age = 17\n}\n\nXCTAssertEqual(person.name, \"Luffy\")\nXCTAssertEqual(person.age, 17)\nXCTAssertNil(person.website)\n```\n\n- Build an existing object\n\n`Car`\n```swift\nclass Car {\n  var model: String = \"\"\n  var price: Int = 0\n}\n\nextension Car: Configurable {}\n```\n\n```swift\nlet car = build(Car()) {\n  $0.model = \"Tesla Model 3\"\n  $0.price = 35_000\n}\n\nXCTAssertEqual(car.model, \"Tesla Model 3\")\nXCTAssertEqual(car.price, 35_000)\n```\n\n### configure\n\n- Member function\n- Configure existing object\n\n```swift\nlet car = Car().configure {\n  $0.model = \"Tesla Model 3\"\n  $0.price = 35_000\n}\n\nXCTAssertEqual(car.model, \"Tesla Model 3\")\nXCTAssertEqual(car.price, 35_000)\n```\n\n## Installation\n\n**Construction** is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'Construction'\n```\n\n**Construction** is also available through [Carthage](https://github.com/Carthage/Carthage).\nTo install just write into your Cartfile:\n\n```ruby\ngithub \"onmyway133/Construction\"\n```\n\n## Author\n\nKhoa Pham, onmyway133@gmail.com\n\n## Contributing\n\nWe would love you to contribute to **Construction**, check the [CONTRIBUTING](https://github.com/onmyway133/Construction/blob/master/CONTRIBUTING.md) file for more info.\n\n## License\n\n**Construction** is available under the MIT license. See the [LICENSE](https://github.com/onmyway133/Construction/blob/master/LICENSE.md) file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonmyway133%2Fconstruction","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fonmyway133%2Fconstruction","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonmyway133%2Fconstruction/lists"}