Mac Developer Library

Developer

Foundation Framework Reference NSCloseCommand Class Reference

Options
Deployment Target:

On This Page
Language:

NSCloseCommand

An instance of NSCloseCommand closes the specified scriptable object or objects—typically a document or window (and its associated document, if any). The command may optionally specify a location to save in and how to handle modified documents (by automatically saving changes, not saving them, or asking the user).

NSCloseCommand is part of Cocoa’s built-in scripting support. It works automatically to support the close command through key-value coding. Most applications don’t need to subclass NSCloseCommand or call its methods.

Inheritance


Conforms To


Import Statement


Swift

import Foundation

Objective-C

@import Foundation;

Availability


Available in OS X v10.0 and later.
  • Returns a constant indicating how to deal with closing any modified documents.

    Declaration

    Swift

    var saveOptions: NSSaveOptions { get }

    Objective-C

    @property(readonly) NSSaveOptions saveOptions

    Return Value

    A constant indicating how to deal with closing any modified documents. The default value returned is NSSaveOptionsAsk. See Constants for a list of possible return values.

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in OS X v10.0 and later.

Data Types

  • The saveOptions method returns one of the following constants to indicate how to deal with saving any modified documents:

    Declaration

    Swift

    enum NSSaveOptions : UInt { case Yes case No case Ask }

    Objective-C

    typedef enum { NSSaveOptionsYes = 0, NSSaveOptionsNo, NSSaveOptionsAsk } NSSaveOptions;

    Constants

    • Yes

      NSSaveOptionsYes

      Indicates a modified document should be saved on closing without asking the user.

      Available in OS X v10.0 and later.

    • No

      NSSaveOptionsNo

      Indicates a modified document should not be saved on closing.

      Available in OS X v10.0 and later.

    • Ask

      NSSaveOptionsAsk

      Indicates the user should be asked before saving any modified documents on closing. When no option is specified, this is the default.

      Available in OS X v10.0 and later.

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in OS X v10.0 and later.