{"id":21842168,"url":"https://github.com/fpg1503/caterpillar","last_synced_at":"2025-06-27T22:06:35.116Z","repository":{"id":56905737,"uuid":"81323006","full_name":"fpg1503/Caterpillar","owner":"fpg1503","description":"🐛 Caterpillar: Type-safe date formats in Swift, no more \"yyyy-MM-dd'T'HH:mm:ssZ\"","archived":false,"fork":false,"pushed_at":"2017-02-08T23:03:49.000Z","size":29,"stargazers_count":49,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-27T15:51:09.104Z","etag":null,"topics":["cocoapods","date","date-format","date-formatting","swift","swift-package-manager","type-safe"],"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/fpg1503.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":"2017-02-08T11:29:42.000Z","updated_at":"2025-02-21T22:54:36.000Z","dependencies_parsed_at":"2022-08-21T02:20:56.440Z","dependency_job_id":null,"html_url":"https://github.com/fpg1503/Caterpillar","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/fpg1503/Caterpillar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fpg1503%2FCaterpillar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fpg1503%2FCaterpillar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fpg1503%2FCaterpillar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fpg1503%2FCaterpillar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fpg1503","download_url":"https://codeload.github.com/fpg1503/Caterpillar/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fpg1503%2FCaterpillar/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262341617,"owners_count":23296069,"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":["cocoapods","date","date-format","date-formatting","swift","swift-package-manager","type-safe"],"created_at":"2024-11-27T22:10:48.791Z","updated_at":"2025-06-27T22:06:35.091Z","avatar_url":"https://github.com/fpg1503.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Caterpillar\n\n[![Platforms](https://img.shields.io/cocoapods/p/Caterpillar.svg)](https://cocoapods.org/pods/Caterpillar)\n[![License](https://img.shields.io/cocoapods/l/Caterpillar.svg)](https://raw.githubusercontent.com/fpg1503/Caterpillar/master/LICENSE)\n\n[![Swift Package Manager](https://img.shields.io/badge/Swift%20Package%20Manager-compatible-brightgreen.svg)](https://github.com/apple/swift-package-manager)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![CocoaPods compatible](https://img.shields.io/cocoapods/v/Caterpillar.svg)](https://cocoapods.org/pods/Caterpillar)\n\n[![Travis](https://img.shields.io/travis/fpg1503/Caterpillar/master.svg)](https://travis-ci.org/fpg1503/Caterpillar/branches)\n[![Cookiecutter-Swift](https://img.shields.io/badge/cookiecutter--swift-framework-red.svg)](http://github.com/cookiecutter-swift/Framework)\n\n🐛 Caterpillar: Type-safe date formats in Swift, no more `\"yyyy-MM-dd'T'HH:mm:ssZ\"`\n\n- [Requirements](#requirements)\n- [Usage](#usage)\n- [Installation](#installation)\n- [Acknowledgments](acknowledgments)\n- [License](#license)\n\n## Requirements\n\n- iOS 8.0+ / Mac OS X 10.10+ / tvOS 9.0+ / watchOS 2.0+\n- Xcode 8.0+\n\n## Usage\n\nSimply create a `Caterpillar` using `Caterpillar()` or `🐛()`, add the desired components and set it in your `DateFormatter`:\n\n```swift\nlet format = 🐛()\n    .year(.fourDigits)\n    .separator(.dash)\n    .month(.zeroPaddedNumber)\n    .separator(.dash)\n    .day(.zeroPaddedNumber)\n    .string(\"T\")\n    .hour(.zeroPaddedTwentyFourHour)\n    .separator(.colon)\n    .minute(.zeroPaddedNumber)\n    .separator(.colon)\n    .second(.zeroPaddedNumber)\n    .timezone(.RFC822)\n\nlet formatter = DateFormatter()\nformatter.setDateFormat(format)\n```\n\n## Installation\n\n### CocoaPods\n\n[CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command:\n\n```bash\n$ gem install cocoapods\n```\n\n\u003e CocoaPods 1.1.0+ is required to build Caterpillar 1.0.0+.\n\nTo integrate Caterpillar into your Xcode project using CocoaPods, specify it in your `Podfile`:\n\n```ruby\nsource 'https://github.com/CocoaPods/Specs.git'\nplatform :ios, '8.0'\nuse_frameworks!\n\npod 'Caterpillar', '~\u003e 1.0.0'\n```\n\nThen, run the following command:\n\n```bash\n$ pod install\n```\n\n### 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 Caterpillar into your Xcode project using Carthage, specify it in your `Cartfile`:\n\n```ogdl\ngithub \"Caterpillar/Caterpillar\" ~\u003e 1.0.0\n```\n### Swift Package Manager\n\nTo use Caterpillar as a [Swift Package Manager](https://swift.org/package-manager/) package just add the following in your Package.swift file.\n\n``` swift\nimport PackageDescription\n\nlet package = Package(\n    name: \"HelloCaterpillar\",\n    dependencies: [\n        .Package(url: \"https://github.com/fpg1503/Caterpillar.git\", \"1.0.0\")\n    ]\n)\n```\n\n### Manually\n\nIf you prefer not to use either of the aforementioned dependency managers, you can integrate Caterpillar into your project manually.\n\n#### Git Submodules\n\n- Open up Terminal, `cd` into your top-level project directory, and run the following command \"if\" your project is not initialized as a git repository:\n\n```bash\n$ git init\n```\n\n- Add Caterpillar as a git [submodule](http://git-scm.com/docs/git-submodule) by running the following command:\n\n```bash\n$ git submodule add https://github.com/fpg1503/Caterpillar.git\n$ git submodule update --init --recursive\n```\n\n- Open the new `Caterpillar` folder, and drag the `Caterpillar.xcodeproj` into the Project Navigator of your application's Xcode project.\n\n    \u003e It should appear nested underneath your application's blue project icon. Whether it is above or below all the other Xcode groups does not matter.\n\n- Select the `Caterpillar.xcodeproj` in the Project Navigator and verify the deployment target matches that of your application target.\n- Next, select your application project in the Project Navigator (blue project icon) to navigate to the target configuration window and select the application target under the \"Targets\" heading in the sidebar.\n- In the tab bar at the top of that window, open the \"General\" panel.\n- Click on the `+` button under the \"Embedded Binaries\" section.\n- You will see two different `Caterpillar.xcodeproj` folders each with two different versions of the `Caterpillar.framework` nested inside a `Products` folder.\n\n    \u003e It does not matter which `Products` folder you choose from.\n\n- Select the `Caterpillar.framework`.\n\n- And that's it!\n\n\u003e The `Caterpillar.framework` is automagically added as a target dependency, linked framework and embedded framework in a copy files build phase which is all you need to build on the simulator and a device.\n\n#### Embeded Binaries\n\n- Download the latest release from https://github.com/fpg1503/Caterpillar/releases\n- Next, select your application project in the Project Navigator (blue project icon) to navigate to the target configuration window and select the application target under the \"Targets\" heading in the sidebar.\n- In the tab bar at the top of that window, open the \"General\" panel.\n- Click on the `+` button under the \"Embedded Binaries\" section.\n- Add the downloaded `Caterpillar.framework`.\n- And that's it!\n\n## Acknowledgments\n\n- [@leoformaggio](https://github.com/leoformaggio) for helping me come up with a name;\n- [@corujautx](https://github.com/corujautx) for giving me hints on how to improve it when it was [just a gist](https://gist.github.com/fpg1503/f583ccfd8ac863b71c621843f5ca31b1);\n\n\n## License\n\nCaterpillar is released under the MIT license. See [LICENSE](https://github.com/fpg1503/Caterpillar/blob/master/LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffpg1503%2Fcaterpillar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffpg1503%2Fcaterpillar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffpg1503%2Fcaterpillar/lists"}