iOS Developer Library

Developer

Foundation Framework Reference NSStreamDelegate Protocol Reference

Options
Deployment Target:

On This Page
Language:

NSStreamDelegate

The NSStreamDelegate protocol defines the optional methods implemented by delegates of NSStream objects.

Inheritance


Not Applicable

Import Statement


import Foundation @import Foundation;

Availability


Available in iOS 4.0 and later.
  • The delegate receives this message when a given event has occurred on a given stream.

    Declaration

    Swift

    optional func stream(_ theStream: NSStream, handleEvent streamEvent: NSStreamEvent)

    Objective-C

    - (void)stream:(NSStream *)theStream handleEvent:(NSStreamEvent)streamEvent

    Parameters

    theStream

    The stream on which streamEvent occurred.

    streamEvent

    The stream event that occurred.

    Discussion

    The delegate receives this message only if theStream is scheduled on a run loop. The message is sent on the stream object’s thread. The delegate should examine streamEvent to determine the appropriate action it should take.

    Import Statement

    import Foundation

    Availability

    Available in iOS 2.0 and later.

    Available as part of an informal protocol prior to iOS 4.0.