Foundation NSTemporaryDirectory() can return nil, but is imported to Swift as non-optional #IUO

Originator:chris
Number:rdar://24095436 Date Originated:2016-01-07
Status:Duplicate of 24026087 (Open) Resolved:
Product:iOS SDK Product Version:iOS SDK 9.2, OS X SDK 10.11, Xcode 7.2
Classification: Reproducible:Always
 
Summary:
Per the Foundation documentation on iOS and OSX, NSTemporaryDirectory() can return nil: "If no such directory is currently available, returns nil."

— https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Functions/#//apple_ref/c/func/NSTemporaryDirectory

But in Swift, the function returns the type String, not an optional or implicitly-unwrapped optional:

public func NSTemporaryDirectory() -> String

Steps to Reproduce:
Navigate to the Swift interface for NSTemporaryDirectory(), or visit the Foundation documentation for that function: https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Functions/#//apple_ref/c/func/NSTemporaryDirectory

Expected Results:
The Swift signature for NSTemporaryDirectory should look like:

public func NSTemporaryDirectory() -> String?

or like:

public func NSTemporaryDirectory() -> String!

Actual Results:
The Swift signature for NSTemporaryDirectory looks like:

public func NSTemporaryDirectory() -> String


Version:
iOS SDK 9.2, OS X SDK 10.11, Xcode 7.2

Comments

Engineering has determined that your bug report is a duplicate of another issue and will be closed.


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!