HUBLiveService

@protocol HUBLiveService <NSObject>

Protocol defining the public API for the Hub Framework Live service

The live service enables live editing of Hub Framework-powered view controllers, using the hublive command line application (you can find it in the /live folder of the Hub Framework repo).

To start the service, simply call startOnPort: with a port number that you wish to enable the hublive application to connect on (the same port should then be supplied when starting hublive). The service will then call its delegate once it has created a view controller for any JSON data that was passed from hublive.

You don’t implement this protocol yourself, instead the Hub Framework contains an implementation of it. Note though that this implementation is only compiled when the application hosting the framework is compiled for DEBUG.

  • The service’s delegate. See HUBLiveServiceDelegate for more information.

    Declaration

    Objective-C

    @property (readwrite, nonatomic, nullable) id<HUBLiveServiceDelegate> delegate;
  • Start the live service on a given port

    When calling this, the live service will start by creating a Bonjour net service for the given port, which the hublive command application can then connect to to push JSON data for live editing.

    Declaration

    Objective-C

    - (void)startOnPort:(NSUInteger)port;

    Parameters

    port

    The port to start the service on

  • Stop the service

    The service will immediately stop and tear down its Bonjour net service.

    Declaration

    Objective-C

    - (void)stop;