{"id":20348808,"url":"https://github.com/christopherkarani/this","last_synced_at":"2025-04-12T01:22:06.649Z","repository":{"id":134339286,"uuid":"113441618","full_name":"christopherkarani/This","owner":"christopherkarani","description":"🌋 Powerful, Clean, Elegant Initialisation ","archived":false,"fork":false,"pushed_at":"2017-12-10T20:14:47.000Z","size":27,"stargazers_count":1,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T21:05:51.000Z","etag":null,"topics":["closure","protocol-oriented","swift"],"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/christopherkarani.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-12-07T11:18:39.000Z","updated_at":"2019-05-30T03:29:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"ef364d21-d956-4e17-b86b-949664008f6d","html_url":"https://github.com/christopherkarani/This","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christopherkarani%2FThis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christopherkarani%2FThis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christopherkarani%2FThis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christopherkarani%2FThis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/christopherkarani","download_url":"https://codeload.github.com/christopherkarani/This/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248501951,"owners_count":21114711,"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":["closure","protocol-oriented","swift"],"created_at":"2024-11-14T22:22:31.335Z","updated_at":"2025-04-12T01:22:06.632Z","avatar_url":"https://github.com/christopherkarani.png","language":"Swift","readme":"\u003cp align=\"center\"\u003e\n\u003ca href=\"https://developer.apple.com/swift\"\u003e\u003cimg src=\"https://img.shields.io/badge/language-Swift4-orange.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://developer.apple.com/ios\"\u003e\u003cimg src=\"https://img.shields.io/badge/platform-iOS11-blue.svg?style=flat\"\u003e\u003c/a\u003e\n\u003ca href=\"https://https://github.com/lyimin/beautifulApp/blob/develop/LICENSE\"\u003e\u003cimg src=\"http://img.shields.io/badge/license-MIT-lightgrey.svg?style=flat\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n# This\n🌋 Powerful, Clean, Elegant Initialisation Sugar 🌋\n\n# Description\n\nThis is a small syntactic extension to NSObject that makes it easier for you to initilialize your object in a very Swifty way.\n\n## Simply\n\n-   `this()` is an extension on all NSObject subclasses\n\n    ```swift\n    let fileManager = FileManager().this {\n       $0.urls(for: .applicationDirectory, in: .userDomainMask)\n    }\n    ```\n    \n    Clean up your initialization Code\n    \n```swift\nlet tableView = UITableView().this {\n    $0.backgroundColor = .white\n    $0.register(UserCell.self, forCellReuseIdentifier: \"CellID\")\n    $0.separatorStyle = .none\n    $0.allowsSelection = false\n}\n```\n\nInitialize in **this** way.\n\n```swift\n  let tableView : UITableView = {\n      let table = UITableView()\n      table.backgroundColor = .white\n      table.register(UserCell.self, forCellReuseIdentifier: \"CellID\")\n      table.separatorStyle = .none\n      table.allowsSelection = false\n      return table\n  }()\n```\n\n### Easy Customization\n\n- Use your own Types With a simple Extension\n\n    ```swift\n    extension CustomType: This {}\n    \n    let instance = CustomType().this {\n      $0.color = .blue\n      $0.label.text = \"Custom Type\"\n    }\n    ```\n\n\n### A Real World Example\n```swift\nclass LoginViewController : UIViewController {\n    var loginButton = UIButton().this {\n        $0.setTitle(\"Login\", for: .normal)\n        $0.backgroundColor = . yellow\n        $0.layer.masksToBounds = true\n        $0.layer.cornerRadius = 5\n    }\n    override func viewDidLoad() {\n        super.viewDidLoad()\n        view.addSubview(loginButton)\n    }\n}\n\n```\n\n### Installing\n\n- **For iOS 8+ projects** with [CocoaPods](https://cocoapods.org):\n\n    ```ruby\n    pod 'This'\n\n\n## Deployment\n\njust `clone` the repo and run on Xcode\n\n\n## Contributing\n\nPlease read [CONTRIBUTING.md](https://github.com/chrisbkarani/This/blob/master/Contribution.md) for details on our code of conduct, and the process for submitting pull requests to us.\n\n\n## Authors\n\n* **Chris Karani** - \n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](https://github.com/chrisbkarani/This/blob/master/LICENSE) file for details\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristopherkarani%2Fthis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchristopherkarani%2Fthis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristopherkarani%2Fthis/lists"}