Adding Input Sources

In most cases, input source objects add themselves to the current run loop as needed, but you can add them manually to get greater control over their behavior.

The NSTimer class method scheduledTimerWithTimeInterval:invocation:repeats:, for example, creates a new timer object and adds it to the NSDefaultRunLoopMode mode of the current run loop. If you instead create the timer with timerWithTimeInterval:invocation:repeats:, you must add it manually to the run loop with the NSRunLoop instance method addTimer:forMode:, which allows you to specify a different mode.

NSPort objects are usually used as part of an NSConnection, which automatically adds its receive port to the appropriate modes as needed. If you have a stand-alone port object, you can manually add it to the run loop with the NSRunLoop method addPort:forMode:.