HtmlConfig.spreadsheetLimit is a TableDimensions boxed in an NSValue. Swift has no @encode, so a caller has to spell the encoding out:
config.spreadsheetLimit = withUnsafeBytes(of: TableDimensions(rows: 100_000, columns: 500)) {
NSValue(bytes: $0.baseAddress!, objCType: "{ODRTableDimensions=II}")
}
That literal is what opendocument-app/OpenDocument.ios#185 now carries, and it is a second source of truth for the struct's layout sitting in a consumer. A field added to ODRTableDimensions breaks it silently: getValue:size: checks the size, not the encoding.
Style+Optionals.swift already solves the read half — "the ObjC layer boxes an absent std::optional as nil in an NSNumber or NSValue, which is faithful but not how Swift reads" — and its header says this is what the target exists for. There is no write half, because HtmlConfig is the only place a boxed property is settable.
Suggestion
An apple/swift/Html+Optionals.swift beside it, naming as that file does (fontColor → color):
extension HtmlConfig {
public var sheetLimit: TableDimensions? { get set }
public var zoom: Double? { get set }
// ...
}
Alternatively drop the boxing on this one property and give ODRHtmlConfig a setSpreadsheetLimit: taking the struct plus a clearSpreadsheetLimit. Less uniform, no new file.
The whole surface
| property |
boxed as |
from Swift today |
spreadsheetLimit |
NSValue / ODRTableDimensions |
only with the encoding literal |
spreadsheetViewportMode |
NSNumber / enum |
NSNumber(value: mode.rawValue) |
spreadsheetCellLimit, viewportWidth, initialZoom, pageRangeEnd |
NSNumber |
NSNumber(value:) |
Only the first is actually blocked; the rest are merely not how Swift reads.
Nothing under apple/tests or apple/swift sets any of them, so the write path has no coverage either.
🤖 Generated with Claude Code
HtmlConfig.spreadsheetLimitis aTableDimensionsboxed in anNSValue. Swift has no@encode, so a caller has to spell the encoding out:That literal is what opendocument-app/OpenDocument.ios#185 now carries, and it is a second source of truth for the struct's layout sitting in a consumer. A field added to
ODRTableDimensionsbreaks it silently:getValue:size:checks the size, not the encoding.Style+Optionals.swiftalready solves the read half — "the ObjC layer boxes an absentstd::optionalasnilin anNSNumberorNSValue, which is faithful but not how Swift reads" — and its header says this is what the target exists for. There is no write half, becauseHtmlConfigis the only place a boxed property is settable.Suggestion
An
apple/swift/Html+Optionals.swiftbeside it, naming as that file does (fontColor→color):Alternatively drop the boxing on this one property and give
ODRHtmlConfigasetSpreadsheetLimit:taking the struct plus aclearSpreadsheetLimit. Less uniform, no new file.The whole surface
spreadsheetLimitNSValue/ODRTableDimensionsspreadsheetViewportModeNSNumber/ enumNSNumber(value: mode.rawValue)spreadsheetCellLimit,viewportWidth,initialZoom,pageRangeEndNSNumberNSNumber(value:)Only the first is actually blocked; the rest are merely not how Swift reads.
Nothing under
apple/testsorapple/swiftsets any of them, so the write path has no coverage either.🤖 Generated with Claude Code