NSSegmentedControl.trackingMode marked unavailable in Xcode 8
Originator: | rsfinn | ||
Number: | rdar://29009132 | Date Originated: | 2016-10-28 |
Status: | Closed | Resolved: | 2017-03-28 |
Product: | Developer Tools (macOS SDK) | Product Version: | Xcode 8.1 |
Classification: | Reproducible: |
Summary: The SDK interface to the `trackingMode` property of `NSSegmentedControl` has been incorrectly marked `@available(OSX 10.10.3, *)` when in fact it is only one of the values for `NSSegmentSwitchTracking` that should be so marked. This causes a compiler error which must be worked around. Steps to Reproduce: Create an Xcode project for macOS with a deployment version of 10.9 and including a source file containing this code (it can be included in the applicationDidFinishLaunching method, for example): let segmented = NSSegmentedControl(frame: NSRect(x: 0, y: 0, width: 85, height: 40)) segmented.trackingMode = .momentary Expected Results: The project should build successfully. Actual Results: Xcode reports a compiler error, both in the source editor and when building the project: error: 'trackingMode' is only available on OS X 10.10.3 or newer segmented.trackingMode = .momentary ^ note: add 'if #available' version check segmented.trackingMode = .momentary ^ note: add @available attribute to enclosing instance method segmented.trackingMode = .momentary ^ note: add @available attribute to enclosing extension segmented.trackingMode = .momentary ^ Version: Xcode 8.1 (8B62) macOS 10.12.1 (16B2657) Notes: Evidence on the Internet suggests that this has been a problem as far back as Xcode 7. It may be possible to work around the problem by using key-value code to set the property, but this should not be required.
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!
Engineering has the following feedback for you:
The macro is correct, the property was added to the control in 10.10. Prior to that you needed to access the tracking mode through the cell.
If you would like to deploy to 10.9, you should call [[segmentedControl cell] setTrackingMode:]
Thank you for your feedback. Engineering has determined that this issue behaves as intended.