From a13d9898dca001631ff163d859a580c5dfc9811a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A9bora=20Lage?= Date: Thu, 24 Apr 2025 22:42:37 -0300 Subject: [PATCH 01/13] fix: typos in facade files --- Sources/Facade/Conceptual/Example.swift | 8 ++++---- Sources/Facade/RealWorld/Example.swift | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Sources/Facade/Conceptual/Example.swift b/Sources/Facade/Conceptual/Example.swift index b0b0e75..cbd1233 100644 --- a/Sources/Facade/Conceptual/Example.swift +++ b/Sources/Facade/Conceptual/Example.swift @@ -66,13 +66,13 @@ class Facade { class Subsystem1 { func operation1() -> String { - return "Sybsystem1: Ready!\n" + return "Subsystem1: Ready!\n" } // ... func operationN() -> String { - return "Sybsystem1: Go!\n" + return "Subsystem1: Go!\n" } } @@ -82,13 +82,13 @@ class Subsystem1 { class Subsystem2 { func operation1() -> String { - return "Sybsystem2: Get ready!\n" + return "Subsystem2: Get ready!\n" } // ... func operationZ() -> String { - return "Sybsystem2: Fire!\n" + return "Subsystem2: Fire!\n" } } diff --git a/Sources/Facade/RealWorld/Example.swift b/Sources/Facade/RealWorld/Example.swift index b51ea1e..c8beca4 100644 --- a/Sources/Facade/RealWorld/Example.swift +++ b/Sources/Facade/RealWorld/Example.swift @@ -10,7 +10,7 @@ class FacadeRealWorld: XCTestCase { /// In the real project, you probably will use third-party libraries. For /// instance, to download images. /// - /// Therefore, facade and wrapping it is a good way to use a third party API + /// Therefore, facade and wrapping it is a good way to use a third-party API /// in the client code. Even if it is your own library that is connected to /// a project. /// @@ -24,7 +24,7 @@ class FacadeRealWorld: XCTestCase { /// fits most client needs. Moreover, it can set frequently used or default /// parameters. - func testFacedeRealWorld() { + func testFacadeRealWorld() { let imageView = UIImageView() @@ -46,7 +46,7 @@ class FacadeRealWorld: XCTestCase { private extension UIImageView { - /// This extension plays a facede role. + /// This extension plays a facade role. func downloadImage(at url: URL?) { @@ -68,7 +68,7 @@ private extension UIImageView { private class ImageDownloader { - /// Third party library or your own solution (subsystem) + /// Third-party library or your own solution (subsystem) typealias Completion = (UIImage, Error?) -> () typealias Progress = (Int, Int) -> () From 5db0ddc4bf3625b7565c720f5a8c8eb6d3776174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A9bora=20Lage?= Date: Thu, 24 Apr 2025 22:44:16 -0300 Subject: [PATCH 02/13] fix: typos in factory method --- Sources/FactoryMethod/RealWorld/Example.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/FactoryMethod/RealWorld/Example.swift b/Sources/FactoryMethod/RealWorld/Example.swift index b396380..a8aee55 100644 --- a/Sources/FactoryMethod/RealWorld/Example.swift +++ b/Sources/FactoryMethod/RealWorld/Example.swift @@ -111,7 +111,7 @@ private class ClientCode { func present(info: String, with factory: ProjectorFactory) { - /// Check wheater a client code already present smth... + /// Check whether the client code is already presenting something... guard let projector = currentProjector else { From d4d56d4a0e7fab3e423b3bc84786512b95bcdc05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A9bora=20Lage?= Date: Thu, 24 Apr 2025 22:46:06 -0300 Subject: [PATCH 03/13] feat: improve flyweight print statement --- Sources/Flyweight/Conceptual/Example.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Flyweight/Conceptual/Example.swift b/Sources/Flyweight/Conceptual/Example.swift index fa85200..d21ee7c 100644 --- a/Sources/Flyweight/Conceptual/Example.swift +++ b/Sources/Flyweight/Conceptual/Example.swift @@ -30,7 +30,7 @@ class Flyweight { } func operation(uniqueState: [String]) { - print("Flyweight: Displaying shared (\(sharedState)) and unique (\(uniqueState) state.\n") + print("Flyweight: Displaying shared (\(sharedState)) and unique (\(uniqueState)) state.\n") } } From 14535c7ca05f48bc6b9c53fb4c7b718208e3c2b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A9bora=20Lage?= Date: Thu, 24 Apr 2025 22:58:59 -0300 Subject: [PATCH 04/13] fix: typos in Iterator files --- Sources/Iterator/Conceptual/Example.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Iterator/Conceptual/Example.swift b/Sources/Iterator/Conceptual/Example.swift index 7396f03..66dfcf5 100644 --- a/Sources/Iterator/Conceptual/Example.swift +++ b/Sources/Iterator/Conceptual/Example.swift @@ -11,7 +11,7 @@ /// - The `AnyIterator` struct provides basic iterator implementation: /// https://developer.apple.com/documentation/swift/anyiterator /// -/// In this examples we'll see how to use both of these mechanisms. +/// In this example, we'll see how to use both of these mechanisms. /// /// RU: Паттерн Итератор /// @@ -32,7 +32,7 @@ import XCTest /// EN: This is a collection that we're going to iterate through using an -/// iterator derived from IteratorProtocol. +/// iterator that conforms to IteratorProtocol /// /// RU: Это коллекция, которую мы будем перебирать используя итератор, /// реализующий IteratorProtocol. From 5d1a1d9c0b3b9acb1a8130524988ab3b69484409 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A9bora=20Lage?= Date: Thu, 24 Apr 2025 23:03:36 -0300 Subject: [PATCH 05/13] fix: logic in tree traversal --- Sources/Iterator/RealWorld/Example.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/Iterator/RealWorld/Example.swift b/Sources/Iterator/RealWorld/Example.swift index b84a314..81c49c1 100644 --- a/Sources/Iterator/RealWorld/Example.swift +++ b/Sources/Iterator/RealWorld/Example.swift @@ -68,13 +68,13 @@ class Tree { private func preOrder(_ body: Block) { body(value) - left?.inOrder(body) - right?.inOrder(body) + left?.preOrder(body) + right?.preOrder(body) } private func postOrder(_ body: Block) { - left?.inOrder(body) - right?.inOrder(body) + left?.postOrder(body) + right?.postOrder(body) body(value) } } From c9952de794dcc4b7fa8ad959f871e27011ba3387 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A9bora=20Lage?= Date: Thu, 24 Apr 2025 23:06:32 -0300 Subject: [PATCH 06/13] fix: warning --- Sources/Observer/Conceptual/Example.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Observer/Conceptual/Example.swift b/Sources/Observer/Conceptual/Example.swift index 9af4ef2..67a0483 100644 --- a/Sources/Observer/Conceptual/Example.swift +++ b/Sources/Observer/Conceptual/Example.swift @@ -116,7 +116,7 @@ class Subject { /// /// RU: Наблюдатель объявляет метод уведомления, который используют издатели для /// оповещения. -protocol Observer: class { +protocol Observer: AnyObject { func update(subject: Subject) } From 356c51c055ac1f8b99ead62c5fb3bf2f0ae885ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A9bora=20Lage?= Date: Thu, 24 Apr 2025 23:14:10 -0300 Subject: [PATCH 07/13] feat: improves readability according to comment pattern --- Sources/Singleton/RealWorld/Example.swift | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Sources/Singleton/RealWorld/Example.swift b/Sources/Singleton/RealWorld/Example.swift index 6cd87ec..867051a 100644 --- a/Sources/Singleton/RealWorld/Example.swift +++ b/Sources/Singleton/RealWorld/Example.swift @@ -38,11 +38,11 @@ class SingletonRealWorld: XCTestCase { class BaseVC: UIViewController, MessageSubscriber { func accept(new messages: [Message]) { - /// handle new messages in the base class + /// Handles new messages in the base class } func accept(removed messages: [Message]) { - /// handle removed messages in the base class + /// Hanldes removed messages in the base class } func startReceiveMessages() { @@ -60,12 +60,12 @@ class MessagesListVC: BaseVC { override func accept(new messages: [Message]) { print("MessagesListVC accepted 'new messages'") - /// handle new messages in the child class + /// Handles new messages in the child class } override func accept(removed messages: [Message]) { print("MessagesListVC accepted 'removed messages'") - /// handle removed messages in the child class + /// Handles removed messages in the child class } override func startReceiveMessages() { @@ -78,12 +78,12 @@ class ChatVC: BaseVC { override func accept(new messages: [Message]) { print("ChatVC accepted 'new messages'") - /// handle new messages in the child class + /// Handles new messages in the child class } override func accept(removed messages: [Message]) { print("ChatVC accepted 'removed messages'") - /// handle removed messages in the child class + /// Handles removed messages in the child class } override func startReceiveMessages() { From efffb6cfbae7db5cd2c89acd8398483423d13600 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A9bora=20Lage?= Date: Thu, 24 Apr 2025 23:15:05 -0300 Subject: [PATCH 08/13] fix: warning --- Sources/State/Conceptual/Example.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/State/Conceptual/Example.swift b/Sources/State/Conceptual/Example.swift index 1822f57..09b6fd2 100644 --- a/Sources/State/Conceptual/Example.swift +++ b/Sources/State/Conceptual/Example.swift @@ -61,7 +61,7 @@ class Context { /// Конкретные Состояния, а также предоставляет обратную ссылку на объект /// Контекст, связанный с Состоянием. Эта обратная ссылка может использоваться /// Состояниями для передачи Контекста другому Состоянию. -protocol State: class { +protocol State: AnyObject { func update(context: Context) From eb003ad31eff9586ec70d9e49c880016c7bf88cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A9bora=20Lage?= Date: Thu, 24 Apr 2025 23:22:58 -0300 Subject: [PATCH 09/13] feat: improve readability using common terms in the swift development universe --- Sources/Bridge/Conceptual/Example.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Bridge/Conceptual/Example.swift b/Sources/Bridge/Conceptual/Example.swift index 46e7fed..e1bc91f 100644 --- a/Sources/Bridge/Conceptual/Example.swift +++ b/Sources/Bridge/Conceptual/Example.swift @@ -24,7 +24,7 @@ import XCTest /// EN: The Abstraction defines the interface for the "control" part of the two -/// class hierarchies. It maintains a reference to an object of the +/// class hierarchies. It holds a reference to an object from the /// Implementation hierarchy and delegates all of the real work to this object. /// /// RU: Абстракция устанавливает интерфейс для «управляющей» части двух иерархий From 676f6ee3dcfd1f4ea447f59310347c69c0b940d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A9bora=20Lage?= Date: Thu, 24 Apr 2025 23:26:32 -0300 Subject: [PATCH 10/13] feat: improves readability in flyweight comments --- Sources/Flyweight/RealWorld/Example.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Flyweight/RealWorld/Example.swift b/Sources/Flyweight/RealWorld/Example.swift index 15639c1..34c7fc8 100644 --- a/Sources/Flyweight/RealWorld/Example.swift +++ b/Sources/Flyweight/RealWorld/Example.swift @@ -27,7 +27,7 @@ class FlyweightRealWorld: XCTestCase { /// Displaying objects for the 2-nd time. /// - /// Note: Cached object of the appearance will be reused this time. + /// Note: The cached appearance object will be reused this time. print("\nClient: I have a new dog, let's show it the same way!\n") @@ -93,7 +93,7 @@ struct Animal: Equatable { struct Appearance: Equatable { - /// This object contains a predefined appearance of every cell + /// This object contains the predefined appearance for each cell. let photos: [UIImage] let backgroundColor: UIColor From a1809cac1ad628eb6fa22ac058bb986fad900bf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A9bora=20Lage?= Date: Thu, 24 Apr 2025 23:26:48 -0300 Subject: [PATCH 11/13] fix: warnings in Command files --- Sources/Command/RealWorld/Example.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/Command/RealWorld/Example.swift b/Sources/Command/RealWorld/Example.swift index ba74b72..6f117a4 100644 --- a/Sources/Command/RealWorld/Example.swift +++ b/Sources/Command/RealWorld/Example.swift @@ -2,7 +2,7 @@ import Foundation import XCTest -class DelayedOperation: Operation { +class DelayedOperation: Operation, @unchecked Sendable { private var delay: TimeInterval @@ -58,7 +58,7 @@ class DelayedOperation: Operation { } } -class WindowOperation: DelayedOperation { +class WindowOperation: DelayedOperation, @unchecked Sendable { override func main() { print("\(self): Windows are closed via HomeKit.") @@ -67,7 +67,7 @@ class WindowOperation: DelayedOperation { override var description: String { return "WindowOperation" } } -class DoorOperation: DelayedOperation { +class DoorOperation: DelayedOperation, @unchecked Sendable { override func main() { print("\(self): Doors are closed via HomeKit.") @@ -76,7 +76,7 @@ class DoorOperation: DelayedOperation { override var description: String { return "DoorOperation" } } -class TaxiOperation: DelayedOperation { +class TaxiOperation: DelayedOperation, @unchecked Sendable { override func main() { print("\(self): Taxi is ordered via Uber") From 9bfe877ce227d42bc694f11abca61422311c33c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A9bora=20Lage?= Date: Thu, 24 Apr 2025 23:27:04 -0300 Subject: [PATCH 12/13] fix: warning --- Sources/ChainOfResponsibility/Conceptual/Example.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/ChainOfResponsibility/Conceptual/Example.swift b/Sources/ChainOfResponsibility/Conceptual/Example.swift index e4d414b..90d6edd 100644 --- a/Sources/ChainOfResponsibility/Conceptual/Example.swift +++ b/Sources/ChainOfResponsibility/Conceptual/Example.swift @@ -17,7 +17,7 @@ import XCTest /// /// RU: Интерфейс Обработчика объявляет метод построения цепочки обработчиков. /// Он также объявляет метод для выполнения запроса. -protocol Handler: class { +protocol Handler: AnyObject { @discardableResult func setNext(handler: Handler) -> Handler From d0b4d76850d45887343390641be1d70f8323ae9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A9bora=20Lage?= Date: Thu, 24 Apr 2025 23:29:50 -0300 Subject: [PATCH 13/13] fix: add missing dot --- Sources/Iterator/Conceptual/Example.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Iterator/Conceptual/Example.swift b/Sources/Iterator/Conceptual/Example.swift index 66dfcf5..4559a5b 100644 --- a/Sources/Iterator/Conceptual/Example.swift +++ b/Sources/Iterator/Conceptual/Example.swift @@ -32,7 +32,7 @@ import XCTest /// EN: This is a collection that we're going to iterate through using an -/// iterator that conforms to IteratorProtocol +/// iterator that conforms to IteratorProtocol. /// /// RU: Это коллекция, которую мы будем перебирать используя итератор, /// реализующий IteratorProtocol.