Fix compiler warnings in the Mac and iOS builds !441

merged merged by cmc on 2026-11-22 02:26 UTC · krz/orgstar:fix-warnings into main

9 files changed, +22 −19

Layout: unified · split

Sources/OrgApp/OverdueBadge.swift +1 −1
@@ -8,7 +8,7 @@ public enum OverdueBadge {
88 public static func counts(_ groups: [AgendaDayGroup], today: Int, days: Int) -> [Int] {
99 func key(_ row: AgendaRow) -> String? {
1010 guard let item = row.item, !row.isDone, item.habit == nil, row.planningDay != nil else { return nil }
11 return "\(item.path):\(item.headingOffset ?? item.markerOffset)"
11 return "\(String(describing: item.path)):\(String(describing: item.headingOffset ?? item.markerOffset))"
1212 }
1313 var overdue = Set(groups.first { $0.day == today }?.overdue.compactMap(key) ?? [])
1414 var counts = [overdue.count]
Sources/OrgApp/PlotChart.swift +1 −1
@@ -200,7 +200,7 @@ public struct PlotChart: View {
200200 }
201201
202202 /// The matrix's value at a fractional column and row, from its four neighbours.
203 static func interpolate(_ m: [[Double]], _ x: Double, _ z: Double) -> Double {
203 nonisolated static func interpolate(_ m: [[Double]], _ x: Double, _ z: Double) -> Double {
204204 guard !m.isEmpty, !m[0].isEmpty else { return 0 }
205205 let c = min(max(x - 1, 0), Double(m[0].count - 1)), r = min(max(z - 1, 0), Double(m.count - 1))
206206 let c0 = Int(c), r0 = Int(r), c1 = min(c0 + 1, m[0].count - 1), r1 = min(r0 + 1, m.count - 1)
Sources/OrgApp/TimerModel.swift +1 −1
@@ -13,7 +13,7 @@ public final class TimerModel {
1313 /// The countdown's message when it ends, for the echo area.
1414 @ObservationIgnored public var onDone: ((String) -> Void)?
1515 @ObservationIgnored private var countdown: Task<Void, Never>?
16 static let notification = "sh.krz.orgstar.org-timer"
16 nonisolated static let notification = "sh.krz.orgstar.org-timer"
1717
1818 public init() {}
1919
Sources/OrgCore/Commands/ElementCommands.swift −1
@@ -39,7 +39,6 @@ public struct InsertDrawer: OrgCommand {
3939 buffer.insert("\n:END:")
4040 if !buffer.eolp { buffer.insert("\n") }
4141 buffer.point = buffer.lineStart(buffer.point) - 1
42 if buffer.lookingAtLine("^:END:") == nil { buffer.point = buffer.lineStart(max(0, buffer.point - 1)) - 1 }
4342 }
4443 }
4544}
Sources/OrgCore/Export/LaTeXExport.swift +1 −2
@@ -1815,10 +1815,9 @@ final class LaTeXRenderer {
18151815 code = "\\includesvg" + code.dropFirst("\\includegraphics".count)
18161816 code = code.replacingOccurrences(of: ".svg}", with: "}")
18171817 }
1818 let above = false
18191818 switch float {
18201819 case .env(let env):
1821 return "\\begin{\(env)}\(placement)\n\(above ? caption : "")\(center ? "\\centering" : "")\n\(code)\n\(above ? "" : caption)\\end{\(env)}"
1820 return "\\begin{\(env)}\(placement)\n\(center ? "\\centering" : "")\n\(code)\n\(caption)\\end{\(env)}"
18221821 case .wrap:
18231822 return "\\begin{wrapfigure}\(placement)\n\(center ? "\\centering" : "")\n\(code)\n\(caption)\\end{wrapfigure}"
18241823 case .sideways:
Sources/OrgstarMobile/AgendaScreen.swift +3 −2
@@ -11,7 +11,7 @@ import SwiftUI
1111struct AgendaScreen: View, Equatable {
1212 let workspace: WorkspaceModel
1313 let session: DocumentSession
14 @Bindable var agenda: AgendaModel
14 let agenda: AgendaModel
1515 let scheduler: ReminderScheduler
1616 @State private var message: String?
1717 @Environment(ClockModel.self) private var clock
@@ -1142,7 +1142,8 @@ struct DateSheet: View {
11421142 }
11431143}
11441144
1145extension AgendaItem: Identifiable {
1145// Module names on both, so the Xcode target, where OrgCore is another package, doesn't warn.
1146extension OrgCore.AgendaItem: Swift.Identifiable {
11461147 public var id: String { "\(path ?? "")|\(headingOffset ?? -1)|\(kind.rawValue)|\(text)" }
11471148
11481149 /// An entry, not a time-grid line.
Sources/OrgstarMobile/DocumentScanner.swift +1 −1
@@ -21,7 +21,7 @@ struct DocumentScanner: UIViewControllerRepresentable {
2121 func makeCoordinator() -> Coordinator { Coordinator(scanned: scanned) }
2222
2323 /// `pages` as a PDF, each page the size of its image in points.
24 static func pdf(_ pages: [UIImage]) -> Data {
24 nonisolated static func pdf(_ pages: [UIImage]) -> Data {
2525 UIGraphicsPDFRenderer(bounds: .zero).pdfData { context in
2626 for page in pages {
2727 let bounds = CGRect(origin: .zero, size: page.size)
Sources/OrgstarMobile/MobileEditor.swift +3 −3
@@ -105,7 +105,7 @@ final class MobileEditor: NSObject, DocumentBuffer {
105105 var knownTags: @Sendable () -> [String] = { [] }
106106
107107 var theme: MobileTheme
108 internal(set) var fold = FoldState()
108 var fold = FoldState()
109109 var globalVisibility: GlobalVisibility?
110110 let hidden = LockedRanges()
111111 /// An arrow key moved the caret, and where it was before; the caret skips folds then.
@@ -125,9 +125,9 @@ final class MobileEditor: NSObject, DocumentBuffer {
125125 /// The line last revealed while markup is hidden, to hide again when the caret leaves.
126126 var revealedLine: NSRange?
127127 /// `org-toggle-inline-images`: lines that are only an image link show the image.
128 internal(set) var showsImages = false
128 var showsImages = false
129129 /// `org-latex-preview`: LaTeX fragments show as typeset math.
130 internal(set) var showsLatex = false
130 var showsLatex = false
131131 /// The view width images were last sized for.
132132 var imageWidth: CGFloat = 0
133133 /// The file's folder, for relative image paths.
Sources/OrgstarMobile/ThemePickerScreen.swift +11 −7
@@ -41,14 +41,18 @@ struct ThemePickerScreen: View {
4141 return Color(.sRGB, red: c.red, green: c.green, blue: c.blue, opacity: c.alpha)
4242 }
4343 let font = Font.system(.footnote, design: .monospaced)
44 func run(_ text: String, _ key: String, bold: Bool = false, underline: Bool = false) -> AttributedString {
45 var run = AttributedString(text)
46 run.foregroundColor = color(key)
47 if bold { run.inlinePresentationIntent = .stronglyEmphasized }
48 if underline { run.underlineStyle = .single }
49 return run
50 }
4451 return VStack(alignment: .leading, spacing: 2) {
45 (Text(verbatim: "* ").foregroundColor(color("heading-1")) + Text(verbatim: "TODO ").foregroundColor(color("todo")).bold()
46 + Text(verbatim: "Plan the trip ").foregroundColor(color("heading-1")).bold() + Text(verbatim: ":travel:").foregroundColor(color("tags")))
47 (Text(verbatim: " SCHEDULED: ").foregroundColor(color("metadata")) + Text(verbatim: "<2026-10-20 Tue>").foregroundColor(color("timestamp")))
48 (Text(verbatim: " Book via ").foregroundColor(color("foreground")) + Text(verbatim: "the site").foregroundColor(color("link")).underline()
49 + Text(verbatim: ", ").foregroundColor(color("foreground")) + Text(verbatim: "~code~").foregroundColor(color("code")))
50 (Text(verbatim: "** ").foregroundColor(color("heading-2")) + Text(verbatim: "DONE ").foregroundColor(color("done")).bold()
51 + Text(verbatim: "Passport").foregroundColor(color("heading-2")).bold())
52 Text(run("* ", "heading-1") + run("TODO ", "todo", bold: true) + run("Plan the trip ", "heading-1", bold: true) + run(":travel:", "tags"))
53 Text(run(" SCHEDULED: ", "metadata") + run("<2026-10-20 Tue>", "timestamp"))
54 Text(run(" Book via ", "foreground") + run("the site", "link", underline: true) + run(", ", "foreground") + run("~code~", "code"))
55 Text(run("** ", "heading-2") + run("DONE ", "done", bold: true) + run("Passport", "heading-2", bold: true))
5256 }
5357 .font(font)
5458 .padding(8)