Skip to content
CodeWiki
Practice
Paths
Tracks
Cheatsheets
Playground
Glossary
AI era
Search
⌘K
English
English
Chinese
Practice
Paths
Tracks
Cheatsheets
Playground
Glossary
AI era
English
English
Chinese
Practice
/
Quiz
/
Swift
/
Structures and classes
How should a public library treat a structure’s synthesized memberwise initializer?
from Structures and classes
Swift 6.3.3
intermediate
1 min
How should a public library treat a structure’s synthesized memberwise initializer?
Declare the promised initializer explicitly because synthesis and access can change with stored properties and custom initializers.
Treat it as permanently public whenever the structure is public.
Replace the structure with a class because classes always synthesize the same initializer.
Check
Ask AI about this kata
Report an error
previous kata
What does let session = Session() guarantee when Session is a class with mutable properti…
Quiz
next kata
What does this program print?
Predict the output
A new version is available
Reload