From b8d2f410a838c49836e2572c8a3c682709153671 Mon Sep 17 00:00:00 2001 From: Edoardo La Greca <35077726+EdoardoLaGreca@users.noreply.github.com> Date: Sat, 10 Feb 2024 14:37:32 +0100 Subject: [PATCH] [swift/en] describe convenience initializers (#4836) --- swift.html.markdown | 3 +++ 1 file changed, 3 insertions(+) diff --git a/swift.html.markdown b/swift.html.markdown index e46dcc75..36124e11 100644 --- a/swift.html.markdown +++ b/swift.html.markdown @@ -679,6 +679,9 @@ class Rect: Shape { // A simple class `Square` extends `Rect` class Square: Rect { + // Use a convenience initializer to make calling a designated initializer faster and more "convenient". + // Convenience initializers call other initializers in the same class and pass default values to one or more of their parameters. + // Convenience initializers can have parameters as well, which are useful to customize the called initializer parameters or choose a proper initializer based on the value passed. convenience init() { self.init(sideLength: 5) }