Swift can't format CGFloats in strings
| Originator: | i | ||
| Number: | rdar://19642575 | Date Originated: | 28-Jan-2015 07:59 PM |
| Status: | Open | Resolved: | |
| Product: | iOS SDK | Product Version: | 8.1.2 |
| Classification: | Security | Reproducible: | Always |
Summary: Swift does not format CGFloat values in format strings because it is defined as a struct. There are no compile time errors — it fails at runtime. See the attached playground. Steps to Reproduce: 1. Run the playground 2. Note the incorrect output on line 8 when attempting to format the CGFloat values Expected Results: It should output "1.000000 2.000000”, as it does when formatting Float and Double values. Actual Results: It outputs "0.000000 0.000000" Regression: Notes:
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
Correct: it's not because it is "defined as a struct" as both Floats and Doubles are as well.