Skip to content

Use only FoundationEssentials when available#476

Draft
t089 wants to merge 1 commit intojpsim:mainfrom
t089:foundation-essentials
Draft

Use only FoundationEssentials when available#476
t089 wants to merge 1 commit intojpsim:mainfrom
t089:foundation-essentials

Conversation

@t089
Copy link
Copy Markdown

@t089 t089 commented Mar 27, 2026

  • Import FoundationEssentials instead of Foundation when available (#if canImport)
  • Gate all NS* types (NSNull, NSArray, NSDictionary, NSMutableArray, NSMutableSet, NSNumber, NSString) behind #if canImport(ObjectiveC) so the library compiles without the Objective-C runtime
  • Replace NSNull with a new pure-Swift YAMLNull type for null value representation
  • Replace NSRegularExpression with Swift Regex for timestamp parsing
  • Replace DateFormatter with Date.ISO8601FormatStyle for date formatting
  • Replace NumberFormatter-based float formatting with a generic formatYAMLFloat function using Swift's built-in LosslessStringConvertible
  • Replace CharacterSet-based checks with Character property checks (e.g. isLetter, isNumber)
  • Replace various Foundation methods (.replacingOccurrences(of:), .components(separatedBy:)) with Swift standard library equivalents (.replacing(), .split())

Switch to `Double.description` for floating point number formatting instead of using `NumberFormatter`.
@t089 t089 mentioned this pull request Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant