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: Абстракция устанавливает интерфейс для «управляющей» части двух иерархий 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 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") 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) -> () 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 { 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") } } 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 diff --git a/Sources/Iterator/Conceptual/Example.swift b/Sources/Iterator/Conceptual/Example.swift index 7396f03..4559a5b 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. 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) } } 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) } 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() { 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)