@@ -294,14 +294,14 @@ extension NSNumber {
294294 }
295295 }
296296
297- /// This number formatted for raw, Swift, or ObjC output (all are the same) .
298- func propertyListFormatted( ) throws -> String {
297+ /// This number formatted for raw, Swift, or ObjC output. Raw and Swift output are the same.
298+ func propertyListFormatted( objCStyle : Bool ) throws -> String {
299299 // For now, use the Objective-C based formatting API for consistency with pre-Swift plutil.
300- return switch betterSwiftType {
300+ let formatted = switch betterSwiftType {
301301 case . true :
302- " true "
302+ objCStyle ? " YES " : " true "
303303 case . false :
304- " false "
304+ objCStyle ? " NO " : " false "
305305 case . signed:
306306 String ( format: " %lld " , int64Value)
307307 case . unsigned:
@@ -314,6 +314,12 @@ extension NSNumber {
314314 case . other:
315315 throw PLUContextError . invalidPropertyListObject ( " Incorrect numeric type for literal \( objCType) " )
316316 }
317+
318+ if objCStyle {
319+ return " @ \( formatted) "
320+ } else {
321+ return formatted
322+ }
317323 }
318324}
319325
@@ -1097,7 +1103,7 @@ func propertyListIsValidForRawFormat(_ propertyList: Any) -> Bool {
10971103/// Output the property list in "raw" string format. Does not descend into collections like array or dictionary.
10981104func rawStringWithPropertyList( _ propertyList: Any ) throws -> String {
10991105 if let num = propertyList as? NSNumber {
1100- return try num. propertyListFormatted ( )
1106+ return try num. propertyListFormatted ( objCStyle : false )
11011107 } else if let string = propertyList as? String {
11021108 return string
11031109 } else if let array = propertyList as? [ Any ] {
0 commit comments