Files
vorleser/VorleserKit/Sources/BookParser/Chapter.swift
T
2026-03-14 05:35:58 +01:00

22 lines
643 B
Swift

#if canImport(UIKit)
import UIKit
#elseif canImport(AppKit)
import AppKit
#endif
/// A chapter of a book. Immutable after construction.
/// `@unchecked Sendable` because NSAttributedString is immutable (not NSMutableAttributedString).
public struct Chapter: @unchecked Sendable {
public let index: Int
public let title: String
public let text: String
public let attributedText: NSAttributedString
public init(index: Int, title: String, text: String, attributedText: NSAttributedString? = nil) {
self.index = index
self.title = title
self.text = text
self.attributedText = attributedText ?? NSAttributedString(string: text)
}
}