Mac Developer Library

Developer

WebKit Framework Reference WebDocumentText Protocol Reference

Options
Deployment Target:

On This Page
Language:

WebDocumentText

Inheritance


Not Applicable

Import Statement


Swift

import WebKit

Objective-C

@import WebKit;

Availability


Available in OS X v10.2 with Safari 1.0 and later.
Available in OS X v10.2.7 and later.

WebDocumentText is an optional protocol for document view objects that display text. This protocol defines methods for accessing document content as strings, and methods for text selection. Classes that adopt this protocol should also adopt WebDocumentView and inherit from NSView.

  • Returns the entire content of the web document as a string.

    Declaration

    Swift

    func string() -> String!

    Objective-C

    - (NSString *)string

    Return Value

    The entire content of the web document.

    Import Statement

    Objective-C

    @import WebKit;

    Swift

    import WebKit

    Availability

    Available in OS X v10.2 with Safari 1.0 and later.

    Available in OS X v10.2.7 and later.

  • Returns the entire content of the web document as an attributed string.

    Declaration

    Swift

    func attributedString() -> NSAttributedString!

    Objective-C

    - (NSAttributedString *)attributedString

    Return Value

    An attributed string containing the entire content of the web document.

    Import Statement

    Objective-C

    @import WebKit;

    Swift

    import WebKit

    Availability

    Available in OS X v10.2 with Safari 1.0 and later.

    Available in OS X v10.2.7 and later.

    See Also

    – string

  • Selects all the text in the web document.

    Declaration

    Swift

    func selectAll()

    Objective-C

    - (void)selectAll

    Import Statement

    Objective-C

    @import WebKit;

    Swift

    import WebKit

    Availability

    Available in OS X v10.2 with Safari 1.0 and later.

    Available in OS X v10.2.7 and later.

    See Also

    – deselectAll

  • Deselects the currently selected text in the web document.

    Declaration

    Swift

    func deselectAll()

    Objective-C

    - (void)deselectAll

    Import Statement

    Objective-C

    @import WebKit;

    Swift

    import WebKit

    Availability

    Available in OS X v10.2 with Safari 1.0 and later.

    Available in OS X v10.2.7 and later.

    See Also

    – selectAll

  • Returns the currently selected text in the web document as a string.

    Declaration

    Swift

    func selectedString() -> String!

    Objective-C

    - (NSString *)selectedString

    Return Value

    The currently selected text in the web document.

    Import Statement

    Objective-C

    @import WebKit;

    Swift

    import WebKit

    Availability

    Available in OS X v10.2 with Safari 1.0 and later.

    Available in OS X v10.2.7 and later.

  • Returns the currently selected text in the web document as an attributed string.

    Declaration

    Swift

    func selectedAttributedString() -> NSAttributedString!

    Objective-C

    - (NSAttributedString *)selectedAttributedString

    Return Value

    An attributed string containing the currently selected text in the web document.

    Import Statement

    Objective-C

    @import WebKit;

    Swift

    import WebKit

    Availability

    Available in OS X v10.2 with Safari 1.0 and later.

    Available in OS X v10.2.7 and later.

  • Returns a Boolean value that indicates whether the web document supports text encoding.

    Declaration

    Swift

    func supportsTextEncoding() -> Bool

    Objective-C

    - (BOOL)supportsTextEncoding

    Return Value

    YEStrue if the web document supports text encoding; otherwise, NOfalse.

    Import Statement

    Objective-C

    @import WebKit;

    Swift

    import WebKit

    Availability

    Available in OS X v10.2 with Safari 1.0 and later.

    Available in OS X v10.2.7 and later.