Defines a subscription listener that wraps an SLSubscriptionListener so that the callbacks are returned on the main GUI thread.
You can pass an SLSubscriptionListenerWrapper to [SLStreamLink subscribe] in place of an SLSubscriptionListener. This allows you to update the GUI from within the wrapped SLSubscriptionListener's callback methods, without having to write boiler-plate code for accessing the GUI thread.
- See also
- SLConnectionListenerWrapper
The following example shows how to create and use an SLSubscriptionListenerWrapper:
#import <StreamLink/StreamLink.h>
@interface ExampleUsingSLSubscriptionListenerWrapper : NSObject<SLSubscriptionListener> {
}
@end
@implementation ExampleUsingSLSubscriptionListenerWrapper
-(void)subscribeToRecord
{
[streamLink connect];
id<SLSubscription> subscription = [streamLink subscribeToSubject:@"/DEMO/MSFT" subscriptionParameters:nil subscriptionListener:listener];
}
@end