{"id":15038956,"url":"https://github.com/fromkk/valy","last_synced_at":"2025-04-10T00:03:26.617Z","repository":{"id":56925849,"uuid":"73786989","full_name":"fromkk/Valy","owner":"fromkk","description":"Valy is string validation library with Swift 4.","archived":false,"fork":false,"pushed_at":"2019-07-18T22:18:13.000Z","size":72,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-10T00:03:03.208Z","etag":null,"topics":["carthage","cocoapods","swift-4","swift4","validation","validation-library","valy"],"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/fromkk.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":"2016-11-15T07:17:46.000Z","updated_at":"2019-07-18T22:18:15.000Z","dependencies_parsed_at":"2022-08-21T05:20:53.812Z","dependency_job_id":null,"html_url":"https://github.com/fromkk/Valy","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fromkk%2FValy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fromkk%2FValy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fromkk%2FValy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fromkk%2FValy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fromkk","download_url":"https://codeload.github.com/fromkk/Valy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248131321,"owners_count":21052819,"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":["carthage","cocoapods","swift-4","swift4","validation","validation-library","valy"],"created_at":"2024-09-24T20:40:57.738Z","updated_at":"2025-04-10T00:03:26.581Z","avatar_url":"https://github.com/fromkk.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Build Status](https://app.bitrise.io/app/dfcd9f87866e7757/status.svg?token=mN4n-Xqm61DJM76VTk3nlQ)](https://app.bitrise.io/app/dfcd9f87866e7757)\n\n\u003cimg src=\"valy.png\" width=\"320\" height=\"auto\" /\u003e\n\n# Valy\n\nValy is string validation library with Swift 5.\n\n# Required\n\n- Swift 5\n- Xcode 10\n- iOS 8~ / watchOS 2~ / tvOS 8~ / macOS 10.16~\n- Carthage or Cocoapods\n\nIf you use Swift 4.2 or before, try [Valy 0.0.6](https://github.com/fromkk/Valy/releases/tag/0.0.6).\n\n# Install\n\n## with Carthage\n\nAdd `github \"fromkk/Valy\"` to **Cartfile** and execute `carthage update` command on your terminal in project directory.  \n\nAdd **Carthage/Build/{Platform}/Valy.framework** to **Link Binary with Libralies** in you project.  \nIf you doesn't use Carthage, add **New Run Script Phase** and input `/usr/local/bin/carthage copy-frameworks` in **Build Phases** tab.  \nAdd `$(SRCROOT)/Carthage/Build/{Platform}/Valy.framework` to **Input Files**.\n\n## with Cocoapods\n\nAdd `pod 'Valy'` to **Podfile** and run `pod install` command on your terminal in project directory.\nOpen `{YourProject}.xcworkspace` file.\n\n# Usage\n\n## Basic\n\n```swift\nimport Valy\n\nlet value: String? = nil\nlet result = Valy.factory(rules: [ValyRule.required]).run(with: value)\nswitch result {\ncase .failure(let rule):\n    switch rule {\n    case ValyRule.required:\n        print(\"value (\\(value)) is required...\")\n    default:\n        break\n    }\ndefault:\n    print(\"value (\\(value)) is successed!\")\n    break\n}\n```\n\n## Add rule\n\n```swift\nValy.factory().add(rule: ValyRule.required).add(rule: ValyRule.maxLength(10)).run(with: value)\n```\n\n## Text Field\n\n```swift\nlet textField = VLTextField(frame: frame)\ntextField.add(rules: [\n    ValyRule.required,\n    ValyRule.maxLength(30)\n])\ntextField.ovserveValidation { (status, result) in\n    switch result {\n    case .success:\n        print(\"textField success\")\n    case .failure(let rule):\n        print(\"failed \\(rule)\")\n    }\n}\n```\n\n## CustomRule\n\n```swift\nenum CustomValidatorRule: AnyValidatorRule {\n    case email\n    func run(with value: String?) -\u003e Bool {\n        switch self {\n        case .email:\n            return doYourEmailValidation()\n        }\n    }\n}\n\nValy.factory().add(rule: CustomValidatorRule.email).run(with: value)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffromkk%2Fvaly","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffromkk%2Fvaly","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffromkk%2Fvaly/lists"}