---
title: "Memberwise Initializer in Swift explained with Code Examples"
url: https://daily.dev/posts/memberwise-initializer-in-swift-explained-with-code-examples-oywf9uwcf
source_url: https://www.avanderlee.com/swift/memberwise-initializers
type: article
source: "SwiftLee"
published: 2026-06-29T13:49:22.298Z
updated: 2026-06-29T13:49:45.747Z
tags: ["swift"]
reading_time: 8
upvotes: 1
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Memberwise Initializer in Swift explained with Code Examples

**[SwiftLee](https://daily.dev/sources/avanderlee)** · 8 min read · 1 upvotes · 0 comments

## Summary

Swift automatically generates memberwise initializers for structs, letting you skip writing boilerplate init code. Swift 6.4 (SE-0502) improves this by excluding private stored properties that already have a default value from the generated initializer. Before this change, a private property with a default value would make the entire memberwise initializer private, forcing developers to write manual initializers. Now, such properties are treated as implementation details and omitted. The rule: a property is excluded only when it is less accessible than the generated initializer AND already has an initial value. Private properties without default values still appear in the initializer. Public structs still require explicit public initializers regardless of this change. A source compatibility overload preserves existing code that initializes private properties through the old synthesized initializer.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.avanderlee.com/swift/memberwise-initializers>

## Similar posts on daily.dev

- [How to declare a memberwise initializer in a Swift extension](https://daily.dev/posts/how-to-declare-a-memberwise-initializer-in-a-swift-extension-lz7tn36hh) · Sarunw · 0 upvotes · 0 comments

---

Tags: [#swift](https://daily.dev/tags/swift)

[View this post on daily.dev](https://daily.dev/posts/memberwise-initializer-in-swift-explained-with-code-examples-oywf9uwcf)
