{"id":26692509,"url":"https://github.com/fazliddinr/viewbinding-delegate","last_synced_at":"2026-05-12T12:11:45.190Z","repository":{"id":100618436,"uuid":"554285015","full_name":"fazliddinR/ViewBinding-Delegate","owner":"fazliddinR","description":null,"archived":false,"fork":false,"pushed_at":"2023-03-12T15:04:42.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-26T17:43:37.477Z","etag":null,"topics":["viewbinding-delegate"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fazliddinR.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2022-10-19T14:55:52.000Z","updated_at":"2022-10-19T15:17:46.000Z","dependencies_parsed_at":"2023-05-16T09:00:25.438Z","dependency_job_id":null,"html_url":"https://github.com/fazliddinR/ViewBinding-Delegate","commit_stats":null,"previous_names":["fazliddinr/viewbinding-delegate"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fazliddinR/ViewBinding-Delegate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fazliddinR%2FViewBinding-Delegate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fazliddinR%2FViewBinding-Delegate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fazliddinR%2FViewBinding-Delegate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fazliddinR%2FViewBinding-Delegate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fazliddinR","download_url":"https://codeload.github.com/fazliddinR/ViewBinding-Delegate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fazliddinR%2FViewBinding-Delegate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278295844,"owners_count":25963427,"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","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["viewbinding-delegate"],"created_at":"2025-03-26T17:33:34.185Z","updated_at":"2025-10-04T09:46:22.275Z","avatar_url":"https://github.com/fazliddinR.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ViewBindingDelegate\n\nA delegate that makes it easier to work with [Android View Binding](https://d.android.com/topic/libraries/view-binding).  \n\nTo enable view binding, set the viewBinding build option to true in the module-level build.gradle file, as shown in the following example:\n\n```groovy\nandroid {\n    buildFeatures {\n        viewBinding true\n    }\n}\n```\nPlease note that you need to copy the source code to work with the delegate, because it's not currently in some repository.\n\n## Fragment sample\n\n###\tThe usual way -\n\n```kotlin\nclass SampleFragment : Fragment() {\n\n    private var _binding: FragmentSampleBinding? = null\n    private val binding get() = _binding!!\n\n    override fun onCreateView(\n        inflater: LayoutInflater,\n        container: ViewGroup?,\n        savedInstanceState: Bundle?\n    ): View {\n        _binding = FragmentSampleBinding.inflate(inflater, container, false)\n        return binding.root\n    }\n\n    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {\n        super.onViewCreated(view, savedInstanceState)\n\n        with(binding) {\n            textView.text = \"Some text\"\n            button.setOnClickListener {\n                //some action\n            }\n        }\n\n    }\n\n    override fun onDestroyView() {\n        super.onDestroyView()\n        _binding = null\n    }\n\n}\n```\n###\tWith the delegate\n\nThe delegate considers fragment's view lifecycle, clears the reference when current view is destroyed and prevent memory leaks.\n\n```kotlin\nclass ListFragment : Fragment(R.layout.fragment_sample) {\n\n    private val binding: FragmentSampleBinding by viewBindings()\n\n    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {\n        super.onViewCreated(view, savedInstanceState)\n\n        with(binding) {\n            textView.text = \"Some text\"\n            button.setOnClickListener {\n                //some action\n            }\n        }\n    }\n```\n\n## Activity sample\n\n```kotlin\nclass MainActivity : AppCompatActivity() {\n\n    private val binding: ActivityMainBinding by viewBindings()\n\n    override fun onCreate(savedInstanceState: Bundle?) {\n        super.onCreate(savedInstanceState)\n        setContentView(binding.root)\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffazliddinr%2Fviewbinding-delegate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffazliddinr%2Fviewbinding-delegate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffazliddinr%2Fviewbinding-delegate/lists"}