{"id":1779,"url":"https://github.com/MaxKramer/SwiftLuhn","last_synced_at":"2025-08-02T04:32:31.310Z","repository":{"id":62456579,"uuid":"54995012","full_name":"maxkramer/SwiftLuhn","owner":"maxkramer","description":"Debit/Credit card validation port of the Luhn Algorithm in Swift","archived":true,"fork":false,"pushed_at":"2024-01-20T18:01:05.000Z","size":124,"stargazers_count":135,"open_issues_count":9,"forks_count":27,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-07-07T21:17:42.443Z","etag":null,"topics":[],"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/maxkramer.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":"2016-03-29T17:11:51.000Z","updated_at":"2024-01-20T18:01:16.000Z","dependencies_parsed_at":"2024-06-19T00:04:31.947Z","dependency_job_id":"2b1f7e85-e072-4098-8332-731eb6ce3b03","html_url":"https://github.com/maxkramer/SwiftLuhn","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/maxkramer/SwiftLuhn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxkramer%2FSwiftLuhn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxkramer%2FSwiftLuhn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxkramer%2FSwiftLuhn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxkramer%2FSwiftLuhn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maxkramer","download_url":"https://codeload.github.com/maxkramer/SwiftLuhn/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxkramer%2FSwiftLuhn/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268334618,"owners_count":24233793,"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-08-02T02:00:12.353Z","response_time":74,"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":[],"created_at":"2024-01-05T20:15:55.618Z","updated_at":"2025-08-02T04:32:30.961Z","avatar_url":"https://github.com/maxkramer.png","language":"Swift","readme":"# SwiftLuhn\n[![Swift](https://img.shields.io/badge/Swift-4.0-orange.svg?style=flat)](https://swift.org)\n[![CircleCI](https://circleci.com/gh/maxkramer/SwiftLuhn.svg?style=svg)](https://circleci.com/gh/maxkramer/SwiftLuhn)\n[![Version](https://img.shields.io/cocoapods/v/SwiftLuhn.svg?style=flat)](http://cocoapods.org/pods/SwiftLuhn)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![License](https://img.shields.io/cocoapods/l/SwiftLuhn.svg?style=flat)](http://cocoapods.org/pods/SwiftLuhn)\n[![Platform](https://img.shields.io/cocoapods/p/SwiftLuhn.svg?style=flat)](http://cocoapods.org/pods/SwiftLuhn)\n\n## Warning! This repository is no longer maintained.\n\nThis is a port of the Luhn Algorithm, generally used for validating debit/credit card details, written in Swift.\n\nSwiftLuhn's HEAD is written in Swift 4. If your project doesn't support Swift 4 yet, please use the [0.2.1 tag](https://github.com/MaxKramer/SwiftLuhn/releases/tag/0.2.1).\n\nObjective-C port can be found at [https://github.com/MaxKramer/ObjectiveLuhn](https://github.com/MaxKramer/ObjectiveLuhn).\n\n## Usage\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first.\n\n## Installation\n\nSwiftLuhn is available through [CocoaPods](http://cocoapods.org) or Carthage (with or without using our pre-built binary). \n\nTo install it, simply add the following line to your Podfile:\n\n```ruby\npod \"SwiftLuhn\" # use '0.2.1' for Swift 3.X\n```\n\nOr alternatively the following line to your Cartfile:\n\n```swift\ngithub \"MaxKramer/SwiftLuhn\"\n```\n\n## Usage\n\n### Validation\n\n\nCall the class method which will throws an exception `SwiftLuhn.CardError` if the card is invalid.\n\n```swift\nlet cardNumber = \"378282246310005\"\ndo {\n    try SwiftLuhn.performLuhnAlgorithm(with: cardNumber)\n    // process payment\n}\ncatch {\n    // invalid, alert user\n}\n```\n\nAlternatively, you can use the `String` category:\n\n```swift\nlet isValid = cardNumber.isValidCardNumber()\n```\n\n### Card Types\n\nYou can also get the type of the card being used which will be one of:\n\n|Card Type|\n|-------------|\n|American Express|\n|Visa|\n|Mastercard|\n|Discover|\n|Diner's Club|\n|JCB|\n\n```swift\ndo {\n    let cardType = try SwiftLuhn.cardType(of: cardNumber)\n}\ncatch {\n\t// card is invalid\n}\n```\n\n## Unit Tests\n\nTo run the unit test suite, please open the example project and hit CMD + U.\n\n## Sources\n\n|Name|Website|Reason|\n|:---|:------|:-----|\n|Paypal|[http://www.paypalobjects.com/en_US/vhelp/paypalmanager_help/credit_card_numbers.htm](http://www.paypalobjects.com/en_US/vhelp/paypalmanager_help/credit_card_numbers.htm)|List of valid credit card numbers for the unit tests|\n\n## License\n\nSwiftLuhn is available under the MIT license. See the LICENSE file for more info.\n\n","funding_links":[],"categories":["Payments"],"sub_categories":["Other Parsing","Other free courses"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMaxKramer%2FSwiftLuhn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMaxKramer%2FSwiftLuhn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMaxKramer%2FSwiftLuhn/lists"}