File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010included :
1111 - Sources
1212
13+ # SwiftLint analyze 的 unused_import 对系统框架 import(Foundation/UIKit/Security 等)存在已知误报:
14+ # swiftc 编译日志 0 条 unused import 警告,删除这些 import 会导致编译失败
15+ # (如 STSecurityModels 依赖 Foundation 的 Date/TimeInterval,见 .github/workflows/swift.yml 的 Analyze 步骤)。
16+ # 该规则已整体禁用(见下方 analyzer_rules),故无需在此按文件排除。
1317excluded :
1418 - Sources/STMarkdown/Resources
1519 - .build
@@ -67,8 +71,15 @@ opt_in_rules:
6771force_cast : error # as! 直接 error
6872
6973analyzer_rules :
70- - unused_import
71- - unused_declaration
74+ # 本仓库是底层公用库:大量 public/internal/fileprivate API 提供给宿主 App / Example 模块调用,
75+ # SwiftLint analyze 的 analyzer_rules 只扫描包内 99 个文件,看不到外部调用方,
76+ # 会系统性误报 unused_import 与 unused_declaration(且 swiftc 编译日志证明 import 必需)。
77+ # 验证依据见下。故整体禁用这两个 analyzer 规则。
78+ # - unused_import : 系统框架 import(Foundation/UIKit/Security 等)被误判为冗余,
79+ # clean build 的 swiftc 编译日志 unused import 警告为 0 条,删除会导致编译失败。
80+ # - unused_declaration: 对外暴露的库 API 在包内无引用,被误判为未使用。
81+ # - unused_import
82+ # - unused_declaration
7283
7384# 公开 API 文档缺失检查:存量 882 个未清零,暂移出 opt_in_rules(见 disabled_rules),
7485# 待文档补齐专项后再恢复并重新纳入 --strict 门槛。仅检查 public 级别。
Original file line number Diff line number Diff line change @@ -32,23 +32,13 @@ public final class STOrientationManager {
3232 }
3333
3434 private func requestGeometryUpdate( _ orientations: UIInterfaceOrientationMask , in windowScene: UIWindowScene ? ) {
35- let targetWindowScene = windowScene ?? self . activeWindowScene ( )
36- if #available( iOS 16 . 0 , * ) , let targetWindowScene {
37- targetWindowScene. requestGeometryUpdate ( . iOS( interfaceOrientations: orientations) ) { error in
38- STLog ( " [STOrientationManager] requestGeometryUpdate failed: \( error. localizedDescription) " )
39- }
40- } else {
41- UIDevice . current. setValue ( self . preferredOrientation ( for: orientations) . rawValue, forKey: " orientation " )
42- UIViewController . attemptRotationToDeviceOrientation ( )
35+ guard let targetWindowScene = windowScene ?? self . activeWindowScene ( ) else {
36+ STLog ( " [STOrientationManager] No active UIWindowScene found; cannot request geometry update. " )
37+ return
38+ }
39+ targetWindowScene. requestGeometryUpdate ( . iOS( interfaceOrientations: orientations) ) { error in
40+ STLog ( " [STOrientationManager] requestGeometryUpdate failed: \( error. localizedDescription) " )
4341 }
44- }
45-
46- private func preferredOrientation( for orientations: UIInterfaceOrientationMask ) -> UIInterfaceOrientation {
47- if orientations. contains ( . portrait) { return . portrait }
48- if orientations. contains ( . landscapeLeft) { return . landscapeLeft }
49- if orientations. contains ( . landscapeRight) { return . landscapeRight }
50- if orientations. contains ( . portraitUpsideDown) { return . portraitUpsideDown }
51- return . portrait
5242 }
5343
5444 private func activeWindowScene( ) -> UIWindowScene ? {
You can’t perform that action at this time.
0 commit comments