Classes

The following classes are available globally.

  • To use this class:

    1. Subclass it with your own view controller.
    2. Set swimListTableView equal to the correct on-screen UITableView in your viewDidLoad. This will register the Swim list with the given UITableView, including setting its dataSource and delegate to refer to this instance of SwimListViewController.
    3. Implement cellForRowAtIndexPath as normal (overriding the fake implementation here).
    See more

    Declaration

    Swift

    public class SwimListViewController : UIViewController, UITableViewDataSource, UITableViewDelegate, SwimListViewHelperDelegate
  • Note that Channel is handling the WebSocket, which often calls on a background thread. Channel is responsible for getting all calls to Downlink onto the main thread so that the UI layer can handle delegate callbacks and model objects easily.

    Declaration

    Swift

    class Channel : WebSocketDelegate
  • A base class that acts as an adapter to a Downlink, to create a different Downlink. This can be used to add additional behavior in the Downlink path.

    This class implements the entire Downlink and DownlinkDelegate protocols, forwarding the calls between self.downlink and the subclass (self.uplink). Any of these forwarding calls can of course be intercepted by the subclass to modify the behavior on the way through.

    Declaration

    Swift

    class DownlinkAdapter : DownlinkBase, DownlinkDelegate
  • A small extension to DownlinkAdapter that simply calls sendSyncRequest when downlinkDidConnect is received. In other words, it starts to synchronize as soon as the lane is connected.

    Declaration

    Swift

    class SynchedDownlinkAdapter : DownlinkAdapter
  • A Batcher will hold onto objects for you for a while, and then give you them back in a batch.

    It will hold onto the first object in the batch for at least minDelay, to give you a chance to add more objects. If you add another object then the batch will be delayed further, to allow it to get even bigger. This will continue until the first object has been delayed by maxDelay, at which point the batch is sent even if new objects are still being added.

    This class does no thread operations of its own. It uses performSelector on the thread that you call addObject on, and you will be called back on that thread.

    Declaration

    Swift

    class Batcher<T>
  • A monitor for network health. This uses the Reachability framework to give a reachable / unreachable indication from the OS, and uses statistics provided by the network layer (Channel) to give a more fine-grained understanding of network health, so that we can indicate whether the connection is healthy or degraded.

    See more

    Declaration

    Swift

    public class SwimNetworkConditionMonitor
  • A simple extension to SwimModelBase that adds latitude and longitude fields.

    This class handles the case where these fields are on the wire in either string or float forms.

    See more

    Declaration

    Swift

    public class SwimLatLongModel : SwimModelBase