Skip to content

Code Quality: Add Sendable conformance for Swift Concurrency safety #177

@leogdion

Description

@leogdion

Problem

Types used across concurrency boundaries don't declare Sendable conformance, despite the project having strict concurrency checking enabled. This could lead to data races.

Files Affected

  1. Examples/Celestra/Sources/Celestra/Models/Article.swift
  2. Examples/Celestra/Sources/Celestra/Models/Feed.swift
  3. Examples/Celestra/Sources/Celestra/Services/RSSFetcherService.swift

Proposed Solution

Add explicit Sendable conformance:

struct Article: Codable, Sendable {
    // ...
}

struct Feed: Codable, Sendable {
    // ...
}

final class RSSFetcherService: Sendable {
    // Ensure all stored properties are Sendable
    // Use actors if mutable state needs protection
}

Impact

  • Concurrency Safety: Prevents data races
  • Compiler Help: Swift concurrency checks catch issues
  • Future-Proofing: Ready for strict concurrency mode

Note

Project has strict concurrency checking enabled in Package.swift, so this is especially important.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions