{"id":18103583,"url":"https://github.com/fcanas/bindbackstop","last_synced_at":"2025-04-06T05:46:32.525Z","repository":{"id":37376693,"uuid":"363721594","full_name":"fcanas/BindBackstop","owner":"fcanas","description":"(Binding\u003cT?\u003e, T) -\u003e Binding\u003cT\u003e","archived":false,"fork":false,"pushed_at":"2021-10-28T01:55:57.000Z","size":5,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"canon","last_synced_at":"2025-03-29T06:02:22.694Z","etag":null,"topics":["bindings","optional","optionals","swift","swiftui"],"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/fcanas.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":"2021-05-02T18:25:49.000Z","updated_at":"2022-06-22T12:32:46.000Z","dependencies_parsed_at":"2022-09-14T15:02:24.196Z","dependency_job_id":null,"html_url":"https://github.com/fcanas/BindBackstop","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/fcanas%2FBindBackstop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcanas%2FBindBackstop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcanas%2FBindBackstop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcanas%2FBindBackstop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fcanas","download_url":"https://codeload.github.com/fcanas/BindBackstop/tar.gz/refs/heads/canon","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247441005,"owners_count":20939235,"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":["bindings","optional","optionals","swift","swiftui"],"created_at":"2024-10-31T22:12:37.387Z","updated_at":"2025-04-06T05:46:32.502Z","avatar_url":"https://github.com/fcanas.png","language":"Swift","readme":"# BindBackstop [![Build](https://github.com/fcanas/BindBackstop/actions/workflows/swift.yml/badge.svg?branch=canon)](https://github.com/fcanas/BindBackstop/actions/workflows/swift.yml)\n\nFor SwiftUI's Bindings, make a non-optional Binding from an optional one, given a default value.\n\nThis is all the code. It's only published here because I've reinvented this too many times.\n\n```swift\nextension Binding {\n    init(_ source: Binding\u003cValue?\u003e, _ defaultValue: Value) {\n        self.init(get: { () -\u003e Value in\n            return source.wrappedValue ?? defaultValue\n        }) { (value) in\n            source.wrappedValue = value\n        }\n    }\n}\n\nextension Binding {\n    func with\u003cT\u003e(default v: T) -\u003e Binding\u003cT\u003e where Value == T? {\n        return Binding\u003cT\u003e(self, v)\n    }\n}\n```\n\n## License\n\nBindBackstop is available under the [MIT license](LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffcanas%2Fbindbackstop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffcanas%2Fbindbackstop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffcanas%2Fbindbackstop/lists"}