{"id":2009,"url":"https://github.com/marmelroy/Format","last_synced_at":"2025-08-02T05:33:22.410Z","repository":{"id":56925388,"uuid":"46286719","full_name":"marmelroy/Format","owner":"marmelroy","description":"A Swift Formatter Kit","archived":false,"fork":false,"pushed_at":"2018-09-05T03:53:22.000Z","size":134,"stargazers_count":1177,"open_issues_count":7,"forks_count":43,"subscribers_count":24,"default_branch":"master","last_synced_at":"2025-07-29T13:59:39.179Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/marmelroy.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-11-16T16:19:47.000Z","updated_at":"2025-07-24T11:12:14.000Z","dependencies_parsed_at":"2022-08-21T06:20:13.881Z","dependency_job_id":null,"html_url":"https://github.com/marmelroy/Format","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/marmelroy/Format","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marmelroy%2FFormat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marmelroy%2FFormat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marmelroy%2FFormat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marmelroy%2FFormat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marmelroy","download_url":"https://codeload.github.com/marmelroy/Format/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marmelroy%2FFormat/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268339405,"owners_count":24234544,"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:16:01.131Z","updated_at":"2025-08-02T05:33:22.084Z","avatar_url":"https://github.com/marmelroy.png","language":"Swift","funding_links":[],"categories":["Libs","Swift","UI","Text"],"sub_categories":["Text","Layout","Other free courses","Other Testing","Keychain"],"readme":"![Format - a Swift Formatter Kit](https://cloud.githubusercontent.com/assets/889949/11407879/e18e5834-93b5-11e5-9d53-31a25d0d97df.png)\n\n[![Build Status](https://travis-ci.org/marmelroy/Format.svg?branch=master)](https://travis-ci.org/marmelroy/Format) [![Version](http://img.shields.io/cocoapods/v/Format.svg)](http://cocoapods.org/?q=Format)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n\n# Format\nA Swift formatter kit. Simple formatting syntax for decimal numbers, currency, mass, addresses, ordinal numbers and hexadecimal colors.\n\n## Usage\n\nImport Format at the top of the Swift file with the content you would like to format.\n\n```swift\nimport Format\n```\n\n## Number Formatting\n\nFormat provides a formatting extension for all number types. To format an Int to two decimal places:\n```swift\nlet formattedNumber = 45.format(Decimals.two) // 45.00\n```\n\nFormat defaults to the user's current locale but a custom locale can be easily provided:\n```swift\nlet frLocale = Locale(identifier: \"FR\")\nlet gbLocale = Locale(identifier: \"GB\")\nlet formattedFRNumber = 99.format(Currency.EUR, locale: frLocale) // 99,00 €\nlet formattedGBNumber = 99.format(Currency.GBP, locale: gbLocale) // £ 99.00\n```\n\nApply any of these formatters to any number type:\n```swift\nDecimals.three // 10.123\nCurrency.USD // $10.12\nGeneral.ordinal // 10th (iOS9+ only)\nGeneral.spellOut // ten point one two three\nGeneral.distance // 30 feet\nMass.person // 67 kg\n```\n\nThe distance formatter assumes the number represents the distance in meters before converting and formatting it to the current locale's preferred unit.\n\n## Address Formatting (iOS9.0+ only)\n\nDifferent cultures have [different ways of displaying addresses](https://en.wikipedia.org/wiki/Address_(geography)#Address_format). Format includes an extension on CLPlacemark that converts the addressDictionary to a formatted string in the current locale:\n\n```swift\nlet address = placemark.format()\n```\nPlease note that this function will produce a deprecated warning when used. This is because Apple is using AddressBook keys in the CLPlacemark and AddressBook was deprecated.\n\nTo format a custom address (all fields are optional strings):\n\n```swift\nlet address = AddressFormatter().format(street, city: city, state: state, postalCode: postalCode, country: country, ISOCountryCode: ISOCountryCode)\n```\n\n## Color Formatting\n\nFormat can help you convert hexadecimal colors from the web to UIColors you can work with:\n\n```swift\nlet color = ColorFormatter().format(\"2ba134\")\n```\n\nIn case of an error, the color will default to black if the string is empty or white if the string is invalid.\n\n### Setting up with Carthage\n\n[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.\n\nYou can install Carthage with [Homebrew](http://brew.sh/) using the following command:\n\n```bash\n$ brew update\n$ brew install carthage\n```\n\nTo integrate Format into your Xcode project using Carthage, specify it in your `Cartfile`:\n\n```ogdl\ngithub \"marmelroy/Format\"\n```\n\n### Setting up with [CocoaPods](http://cocoapods.org/?q=PhoneNumberKit)\n```ruby\nsource 'https://github.com/CocoaPods/Specs.git'\npod 'Format', '~\u003e 0.5'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarmelroy%2FFormat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarmelroy%2FFormat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarmelroy%2FFormat/lists"}