Xcode Playgrounds: Can’t use NSMeasurementFormatter to Format Measurements
Originator: | SlaunchaMan | ||
Number: | rdar://27460423 | Date Originated: | 20-Jul-2016 04:23 PM |
Status: | Duplicate/27173952/Closed | Resolved: | |
Product: | Developer Tools | Product Version: | Xcode Version 8.0 beta 3 (8S174q) |
Classification: | Serious Bug | Reproducible: | Always |
Summary: Trying to use the string(from:) method on MeasurementFormatter in a Swift Playground fails as there are two methods that match the signature, and the compiler can’t figure out which one to use. Steps to Reproduce: 1. Create a Measurement in a playground. 2. Create a MeasurementFormatter to format it. 3. Call string(from:) on the formatter, passing in the measurement. Expected Results: The method returns a string. Actual Results: The compiler fails to build the playground. Here are the relevant messages: Playground execution failed: error: Measurements.playground:1:51: error: cannot invoke 'string' with an argument list of type '(from: Measurement<UnitTemperature>)' let formattedTemperature = MeasurementFormatter().string(from: idealTemperature) ^ Measurements.playground:1:51: note: overloads for 'string' exist with these partially matching parameter lists: (from: Measurement<Unit>), (from: Unit) let formattedTemperature = MeasurementFormatter().string(from: idealTemperature) Version: Version 8.0 beta 3 (8S174q) Notes: See attached playground.
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!