3329a2ac82
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
22 lines
643 B
Swift
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)
|
|
}
|
|
}
|