Protocols

The following protocols are available globally.

  • Deserializable is a type that can be extracted from a BinaryDecoder.

    This is typically used to extract an object or a struct from the decoder when a Map is being loaded.

    Note: Mappedin will supply source that implements this for you you should not have to do anything.

    See more

    Declaration

    Swift

    public protocol Deserializable
  • A protocol used to classify what is or what isn’t an Direction Action

    Declaration

    Swift

    public protocol DirectionsInstructionAction
  • All classes that implement the Navigatable protocol can be navigated to and from any other Navigatable object.

    For example, you can navigate from a Coordinate to a Location and you will get a path from that Coordinate to the closest entrance node belonging to that Location. Beyond just pathing to a store, this might also be used for a “take me to the closest washroom” function. You can also navigate from an array of Navigatables to an Array of other Navigatables, and you will get the shortest path between an item in the first group to the second. This allows the ability to do advanced, high level things like “find a place to park that takes you closest to any restaurant”.

    See more

    Declaration

    Swift

    public protocol Navigatable
  • Allows the Camera of the MapView to focus on this position.

    This is currently not intended to be implemented directly by 3rd party, but as an aid to glue SDK components together and keep the API simple.

    See more

    Declaration

    Swift

    public protocol Focusable
  • The MapViewDelegate will receive events and messages from the MapView.

    See more

    Declaration

    Swift

    public protocol MapViewDelegate : AnyObject
  • A position is anything that can return a vector3 in a map, it is used to help place Elements in the screen.

    The most types to be used as a Position are Vector3 or Coordinate

    See more

    Declaration

    Swift

    public protocol Position
  • Used to connect to the Mappedin servers and retrieve venue data a Service once implemented is used to hold the apiKey’s and Venue type required to use the Mappedin SDK

    • Example:

        class ExampleService: Mappedin.Service {
            typealias VenueType = Venue
      
            let apiKey = "<key>"
            let apiSecret = "<secret>"
            let dataKey = "<data>"
      
            required init() {}
        }
      
        // It's important to have this step, this will modify the AppDelegate
        // to include Mappedin's analytics frameworks, your service will not
        // function if you do not install this. 
        public let service = ExampleService(AppDelegate.self)
      
        // With that created, we can now initialized, we can call the Mappedin
        // API in order to get the required data from our servers.
        service.getVenues()
           .onComplete{ venues in
               // find your venue from the list of venues that
               service.getVenue(venues.first!).onComplete { venue in
                   // With a venue loaded we can setup the MapView
                   // but that will be shown in another example.
               }
            }
      
    See more

    Declaration

    Swift

    public protocol Service