[swift-evolution] [Review] SE-0112: Improved NSError Bridging

Douglas Gregor dgregor at apple.com
Wed Jul 6 12:09:02 CDT 2016


> On Jul 5, 2016, at 10:35 PM, Ben Rimmington <me at benrimmington.com> wrote:
> 
> 
>> On 5 Jul 2016, at 21:41, Douglas Gregor <dgregor at apple.com <mailto:dgregor at apple.com>> wrote:
>> 
>>> The following comment is incorrect, AFAIK. The `helpAnchor` is the name attribute of a HTML anchor element.
>>> 
>>> 	/// A localized message providing "help" text if the user requests help.
>>> 	var helpAnchor: String? { get }
>> 
>> Apple’s documentation says:
>> 
>> NSHelpAnchorErrorKey
>> The corresponding value is an NSString containing the localized help corresponding to the help button. See helpAnchor <https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSError_Class/#//apple_ref/occ/instp/NSError/helpAnchor> for more information.
>> 
> 
> A `helpAnchor` in AppKit is the name of an HTML anchor element:
> 
> AppKit > NSPrintPanel > helpAnchor
> <https://developer.apple.com/reference/appkit/nsprintpanel/1490537-helpanchor <https://developer.apple.com/reference/appkit/nsprintpanel/1490537-helpanchor>>
> 
> AppKit > NSHelpManager > openHelpAnchor(_:inBook:)
> <https://developer.apple.com/reference/appkit/nshelpmanager/1500908-openhelpanchor <https://developer.apple.com/reference/appkit/nshelpmanager/1500908-openhelpanchor>>
> 
> Apple Help Programming Guide > Authoring Apple Help > Indexing Your Help Book > Setting Anchors
> <https://developer.apple.com/library/mac/documentation/Carbon/Conceptual/ProvidingUserAssitAppleHelp/authoring_help/authoring_help_book.html#//apple_ref/doc/uid/TP30000903-CH206-CHDFBEHF <https://developer.apple.com/library/mac/documentation/Carbon/Conceptual/ProvidingUserAssitAppleHelp/authoring_help/authoring_help_book.html#//apple_ref/doc/uid/TP30000903-CH206-CHDFBEHF>>

The relevant “helpAnchor” is from the NSError reference documentation:

	https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSError_Class/#//apple_ref/occ/instp/NSError/helpAnchor <https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSError_Class/#//apple_ref/occ/instp/NSError/helpAnchor>

which says:

A string to display in response to an alert panel help anchor button being pressed. (read-only)

Declaration
SWIFT
var helpAnchor: String <https://developer.apple.com/library/mac/documentation/Swift/Reference/Swift_String_Structure/index.html#//apple_ref/swift/struct/s:SS>? { get }
OBJECTIVE-C
@property(readonly, copy) NSString  <https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/index.html#//apple_ref/doc/c_ref/NSString>*helpAnchor
Discussion
The object in the user info dictionary for the key NSHelpAnchorErrorKey <https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSError_Class/#//apple_ref/c/data/NSHelpAnchorErrorKey>. If the user info dictionary doesn’t contain a value for NSHelpAnchorErrorKey <https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSError_Class/#//apple_ref/c/data/NSHelpAnchorErrorKey>, this property is nil.

If this property is non-nil for an error being presented by alertWithError: <https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSAlert_Class/index.html#//apple_ref/occ/clm/NSAlert/alertWithError:>, the alert panel will include a help anchor button that can display this string.

Availability
Available in OS X v10.6 and later.

	- Doug

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160706/c80a25a0/attachment.html>


More information about the swift-evolution mailing list