{"id":17053894,"url":"https://github.com/mpon/swiftbonddemo","last_synced_at":"2025-04-12T16:50:27.055Z","repository":{"id":26832509,"uuid":"30291808","full_name":"mpon/SwiftBondDemo","owner":"mpon","description":"SwiftBond/Bond demo","archived":false,"fork":false,"pushed_at":"2015-08-12T02:10:38.000Z","size":1100,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-04T03:29:11.519Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/SwiftBond/Bond","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/mpon.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":"2015-02-04T09:41:52.000Z","updated_at":"2021-09-22T03:06:44.000Z","dependencies_parsed_at":"2022-09-12T05:40:14.504Z","dependency_job_id":null,"html_url":"https://github.com/mpon/SwiftBondDemo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpon%2FSwiftBondDemo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpon%2FSwiftBondDemo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpon%2FSwiftBondDemo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpon%2FSwiftBondDemo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mpon","download_url":"https://codeload.github.com/mpon/SwiftBondDemo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248601218,"owners_count":21131607,"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":[],"created_at":"2024-10-14T10:13:33.155Z","updated_at":"2025-04-12T16:50:27.017Z","avatar_url":"https://github.com/mpon.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"[SwiftBond/Bond](https://github.com/SwiftBond/Bond) Demo\n=====\n\nUITextField and UISlider\n---\n\n### About\n\n![demo1](demo1.gif)\n\n### Code\n\n```swift\noverride func viewDidLoad() {\n    super.viewDidLoad()\n\n    // UITextField\n    textField -\u003e\u003e textLabel\n\n    // UISlider\n    slider\n        .valueDynamic()\n        .map({\"Hi, my value is \\($0)\"})\n        -\u003e\u003e sliderLabel\n}\n```\n\nValidation\n---\n\n### About\n\nThis is the common example of validating a signup form.\n\n- rule1: you are able to push the button, to satisfy the follwing conditions. \n    1. username and email are not empty.\n    2. password and password confirmation are equal.\n    3. password length is more than 8 characters.\n- rule2: if password and password confirmation are different, output error message.\n\n![demo2](demo2.gif)\n\n### Code\n\n```swift\noverride func viewDidLoad() {\n    super.viewDidLoad()\n\n    // designate text dynamic\n    let username = usernameField.textDynamic()\n    let email = usernameField.textDynamic()\n    let password = passwordField.textDynamic()\n    let passwordConfirm = passwordConfirmField.textDynamic()\n\n    // ============= rule1 =============\n    let rule1a = reduce(username, email, false) { !($0.isEmpty || $1.isEmpty) }\n    let rule1b = reduce(password, passwordConfirm, false) { $0 == $1 }\n    let rule1c = password.map { countElements($0) \u003e= 8 }\n    reduce(rule1a, rule1b, rule1c, false) { $0 \u0026\u0026 $1 \u0026\u0026 $2 } -\u003e\u003e createButton\n\n    // ============= rule2 =============\n    reduce(password, passwordConfirm, \"\") {\n        $0 == $1 ? \"\" : \"The password does not match\"\n    } -\u003e\u003e errorLabel\n\n}\n```\n\nGetting Started\n-----\n\n```\n$ git clone https://github.com/mpon/SwiftBondDemo.git\n$ bundle install --path=vendor/bundle\n$ bundle exec pod install\n$ open SwiftBondDemo.xcworkspace\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmpon%2Fswiftbonddemo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmpon%2Fswiftbonddemo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmpon%2Fswiftbonddemo/lists"}