https://github.com/GottaGetSwifty/CodableWrappers
A Collection of PropertyWrappers to make custom Serialization of Swift Codable Types easy
https://github.com/GottaGetSwifty/CodableWrappers
codable ios property-wrappers swift swift-package-manager swift5-1
Last synced: 20 days ago
JSON representation
A Collection of PropertyWrappers to make custom Serialization of Swift Codable Types easy
- Host: GitHub
- URL: https://github.com/GottaGetSwifty/CodableWrappers
- Owner: GottaGetSwifty
- License: apache-2.0
- Created: 2019-09-18T03:26:06.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-05-05T19:42:58.000Z (11 months ago)
- Last Synced: 2024-10-01T01:11:54.359Z (7 months ago)
- Topics: codable, ios, property-wrappers, swift, swift-package-manager, swift5-1
- Language: Swift
- Homepage:
- Size: 205 KB
- Stars: 643
- Watchers: 12
- Forks: 39
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- fucking-awesome-swift - CodableWrappers - A Collection of PropertyWrappers to make custom Serialization of Codable Types easy. (Misc / Vim)
- awesome-swift - CodableWrappers - A Collection of PropertyWrappers to make custom Serialization of Codable Types easy. (Misc / Vim)
- awesome-swift - CodableWrappers - A Collection of PropertyWrappers to make custom Serialization of Swift Codable Types easy ` 📝 16 days ago ` (Misc [🔝](#readme))
- awesome-swift - CodableWrappers - A Collection of PropertyWrappers to make custom Serialization of Codable Types easy. (Misc / Vim)
- stars - CodableWrappers
- stars - CodableWrappers
README
# CodableWrappers
[](https://swiftpackageindex.com/GottaGetSwifty/CodableWrappers/documentation/codablewrappers)
[](https://swiftpackageindex.com/GottaGetSwifty/CodableWrappers)
[](https://swiftpackageindex.com/GottaGetSwifty/CodableWrappers)
[](https://codecov.io/github/GottaGetSwifty/CodableWrappers)## Simplified Serialization with [Property Wrappers](https://github.com/apple/swift-evolution/blob/master/proposals/0258-property-wrappers.md)
Make Complex Codable Serialization a breeze with declarative annotations!
```swift
@CustomCodable @SnakeCase
struct User: Codable {
let firstName: String
let lastName: String
@SecondsSince1970DateCoding
var joinDate: Date
@CustomCodingKey("data")
var imageData: Data
}
```3.0 released! [Release Notes](https://github.com/GottaGetSwifty/CodableWrappers/blob/master/ReleaseNotes.md)
---
## Documentation
[Full DocC documentation here](https://swiftpackageindex.com/GottaGetSwifty/CodableWrappers/documentation/codablewrappers) thanks to the Swift Package Index!
## Installation
### Swift Package Manager \***Preferred***
URL:
`https://github.com/GottaGetSwifty/CodableWrappers.git`
Manifest:
```swift
dependencies: [
.package(url: "https://github.com/GottaGetSwifty/CodableWrappers.git", .upToNextMajor(from: "3.0.0" )),
]
```### CocoaPods
\***WARNING*** CocoaPods is not currently supported for version 3.0 to avoid complications with Swift Macros.
---```ruby
pod 'CodableWrappers', '~> 2.0.0'
```## Available CodingKey Macros
- [@CustomCodable](CodingKeyMacrosDocumentation.md/#customcodable)
- [@CustomCodingKey(String)](CodingKeyMacrosDocumentation.md/#customcodingkeystring)
- [@CodingKeyPrefix(String)](CodingKeyMacrosDocumentation.md/#codingkeyprefixstring)
- [@CodingKeySuffix(String)](CodingKeyMacrosDocumentation.md/#codingkeysuffixstring)
- [@CamelCase](CodingKeyMacrosDocumentation.md/#camelcase)
- [@FlatCase](CodingKeyMacrosDocumentation.md/#flatcase)
- [@PascalCase](CodingKeyMacrosDocumentation.md/#pascalcase)
- [@UpperCase](CodingKeyMacrosDocumentation.md/#uppercase)
- [@SnakeCase](CodingKeyMacrosDocumentation.md/#snakecase)
- [@CamelSnakeCase](CodingKeyMacrosDocumentation.md/#camelsnakecase)
- [@PascalSnakeCase](CodingKeyMacrosDocumentation.md/#pascalsnakecase)
- [@ScreamingSnakeCase](CodingKeyMacrosDocumentation.md/#screamingsnakecase)
- [@KebabCase](CodingKeyMacrosDocumentation.md/#kebabcase)
- [@CamelKebabCase](CodingKeyMacrosDocumentation.md/#camelkebabcase)
- [@PascalKebabCase](CodingKeyMacrosDocumentation.md/#pascalkebabcase)
- [@ScreamingKebabCase](CodingKeyMacrosDocumentation.md/#screamingkebabcase)## Available Property Wrappers
- [@EncodeNulls](PropertyWrappersDocumentation.md/#encodenulls)
- [Lossy Collections](PropertyWrappersDocumentation.md/#lossy-collections)
- [Empty Defaults](PropertyWrappersDocumentation.md/#empty-defaults)
- [Other Fallbacks](PropertyWrappersDocumentation.md/#other-fallbacks)
- [@OmitCoding](PropertyWrappersDocumentation.md/#omitcoding)
- [@Base64Coding](PropertyWrappersDocumentation.md/#base64coding)
- [@SecondsSince1970DateCoding](PropertyWrappersDocumentation.md/#secondssince1970datecoding)
- [@MillisecondsSince1970DateCoding](PropertyWrappersDocumentation.md/#millisecondssince1970datecoding)
- [@DateFormatterCoding\](PropertyWrappersDocumentation.md/#dateformattercodingdateformatterstaticcoder)
- [@ISO8601Coding](PropertyWrappersDocumentation.md/#iso8601coding)
- [@ISO8601DateFormatStyleCoding\](PropertyWrappersDocumentation.md/#iso8601dateformatstylecodingiso8601dateformatstylestaticcoder)
- [@NonConformingFloatCoding\](PropertyWrappersDocumentation.md/#nonconformingfloatcodingvalueprovider)
- [@NonConformingDoubleCoding\](PropertyWrappersDocumentation.md/#nonconformingdoublecodingvalueprovider)
- [Bool Coding](PropertyWrappersDocumentation.md/#bool-coding)
- [Additional Customization](PropertyWrappersDocumentation.md/#additional-customization)
- [Property Mutability](PropertyWrappersDocumentation.md/#property-mutability)
- [Only Encoding or Decoding](PropertyWrappersDocumentation.md/#only-encoding-or-decoding)## Additional Customization
- [Property Mutability](PropertyWrappersDocumentation.md/#property-mutability)
- [Optionals](PropertyWrappersDocumentation.md/#optionals)
- [Only Encoding or Decoding](PropertyWrappersDocumentation.md/#only-encoding-or-decoding)## Additional Links
- [Introduction Blog Post](https://www.getswifty.blog/blog/making-custom-serialization-a-breeze-in-swift-51-with-property-wrappers)
- [Custom Examples](https://github.com/GottaGetSwifty/CodableWrappers/blob/master/CustomExamples.md)
- [Release Notes](https://github.com/GottaGetSwifty/CodableWrappers/blob/master/ReleaseNotes.md)---
## Compatibility
- 3.x supports Swift 5.9+
- 2.x supports Swift 5.2+
- 1.x supports Swift 5.1+---
## Contributions
If there is a standard Serialization or Coding Key strategy that could be added feel free to open an issue requesting it and/or submit a pull request with the new option.