From 6bc1c692b5cd50ea1bf2a5bc2ab1dd739ae44152 Mon Sep 17 00:00:00 2001 From: "Evgeny @ SimpleX Chat" <259188159+evgeny-simplex@users.noreply.github.com> Date: Tue, 27 Oct 2026 10:09:16 +0000 Subject: [PATCH] docs: the Swift rule covers extension members, not file-scope functions (#7904) --- apps/ios/CLAUDE.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/ios/CLAUDE.md b/apps/ios/CLAUDE.md index c2722350fa..a75cbe027a 100644 --- a/apps/ios/CLAUDE.md +++ b/apps/ios/CLAUDE.md @@ -2,11 +2,12 @@ ## Swift code -- Functions and computed properties are declared in the body of the type they belong to, never at file scope or in an extension of a type declared in this project. -- A member of a SimpleXChat type is declared in that type when everything it uses is available in SimpleXChat. A member that depends on the app is a static member of the app type that uses it; when several app types use it, of the type that names its concept. - An extension is written only where Swift has no other form: - a SwiftUI environment value, which SwiftUI requires as a property of EnvironmentValues; - a conformance, required by an API, of a type declared in another module. +- Members of a type declared in this project are declared in the body of that type, not in an extension. +- A member of a SimpleXChat type is declared in that type; a value it needs from the app is passed as a parameter. - A view modifier is a ViewModifier type applied with `.modifier(_:)`. - A custom alignment is a static constant of a non-generic type that uses it. -- A new member is declared in its type even when the file already extends that type. Existing extensions and file-scope functions are moved only in a task that concerns them. +- Functions and constants at file scope are kept at file scope. +- A new member is declared in its type even when the file already extends that type. Existing extensions are moved only in a task that concerns them.