Mac Developer Library

Developer

AppKit Framework Reference NSURL Additions Reference

Options
Deployment Target:

On This Page
Language:

NSURL

The Application Kit extends Foundation’s NSURL class by adding support for pasteboards. NSWorkspace provides openURL: to open a location specified by a URL.

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Swift

import AppKit

Objective-C

@import AppKit;

Availability


Available in OS X v10.0 and later.
  • Reads an NSURL object off of pasteboard. Returns nil if pasteboard does not contain data of type NSURLPboardType.

    Declaration

    Swift

    init?(fromPasteboard pasteBoard: NSPasteboard) -> NSURL

    Objective-C

    + (NSURL *)URLFromPasteboard:(NSPasteboard *)pasteBoard

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Writes the receiver to pasteboard. You must declare an NSURLPboardType data type for pasteboard before invoking this method; otherwise it returns without doing anything.

    Declaration

    Swift

    func writeToPasteboard(_ pasteBoard: NSPasteboard)

    Objective-C

    - (void)writeToPasteboard:(NSPasteboard *)pasteBoard

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.