Skip to content

Repository files navigation

DefaultEmptyPropertyWrapperSwiftCodable

Sample code demonstrating Build a @DefaultEmpty property wrapper that automatically defaults missing or null array fields to an empty array when decoding JSON in Swift..

This project accompanies the article: Creating a @DefaultEmpty Property Wrapper for Codable in Swift

Requirements

  • Xcode 26.2+
  • iOS 26.0+
  • macOS 26.0+
  • Swift 6.0

Getting Started

  1. Clone this repository
  2. Run xcodegen generate (requires XcodeGen)
  3. Open DefaultEmptyPropertyWrapperSwiftCodable.xcodeproj
  4. Build and run

What's Included

  • App.swift: Source file
  • DefaultEmpty.swift: Source file
  • User.swift: Source file
  • ContentView.swift: Source file

Learn More

Read the full article at BleepingSwift for detailed explanations and additional examples.

License

MIT License - see LICENSE for details.

About

Build a @DEFAULTEMPTY property wrapper that automatically defaults missing or null array fields to an empty array when decoding JSON in Swift.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages