Skip to content
This repository has been archived by the owner on Nov 5, 2020. It is now read-only.

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
okhanokbay committed Mar 29, 2018
1 parent 04fe60a commit 7145f9f
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,7 @@ MapViewPlus gives you the missing methods of MapKit which are: ```imageForAnnota
4) Make it user interaction enabled (this may be easy but tricky sometimes)
5) Scrolls map view to show the callout view completely after tapping the annotation view
5) Even give a ready-to-use template for callout view
6) Forward all of the delegate methods of ```MKMapView``` to your subclass of ```MapViewPlus``` (except ```mapView:viewForAnnotation:```)


### Forwarding Delegate Methods

```MapViewPlus``` uses methods from ```MKMapViewDelegate```, but not all of them. It forwards all of the delegate methods except ```mapView:viewForAnnotation:```. This method is used internally and won't be redirected to your subclass.

Normally, ```MapViewPlus``` will abstract you from ```MapKit``` when you don't want to use the other methods of ```MKMapViewDelegate```. But when you want to use the other methods from ```MKMapViewDelegate```, you can easily do that without any extra efforts. Just write them down and they will get called by ```MapViewPlusDelegate```. Please see how ```mapView(_:regionDidChangeAnimated:)``` method is being called in ```DefaultCalloutViewController.swift``` (in the example project) even if you don't conform to ```MKMapViewDelegate```. If in the future, some new methods are added to ```MKMapViewDelegate```, they will be automagically forwarded to you by ```MapViewPlusDelegate``` without a new version of the framework. There is no wrapping occuring in the background.
6) [Forward all of the delegate methods](#forwarding-delegate-methods) of ```MKMapView``` to your subclass of ```MapViewPlus``` (except ```mapView:viewForAnnotation:```)

## Requirements

Expand Down Expand Up @@ -229,6 +222,12 @@ func mapView(_ mapView: MapViewPlus, fillColorForAnchorOf calloutView: CalloutVi

- Custom view option for annotations

### Forwarding Delegate Methods

```MapViewPlus``` uses methods from ```MKMapViewDelegate```, but not all of them. It forwards all of the delegate methods except ```mapView:viewForAnnotation:```. This method is used internally and won't be redirected to your subclass.

Normally, ```MapViewPlus``` will abstract you from ```MapKit``` when you don't want to use the other methods of ```MKMapViewDelegate```. But when you want to use the other methods from ```MKMapViewDelegate```, you can easily do that without any extra efforts. Just write them down and they will get called by ```MapViewPlusDelegate```. Please see how ```mapView(_:regionDidChangeAnimated:)``` method is being called in ```DefaultCalloutViewController.swift``` (in the example project) even if you don't conform to ```MKMapViewDelegate```. If in the future, some new methods are added to ```MKMapViewDelegate```, they will be automagically forwarded to you by ```MapViewPlusDelegate``` without a new version of the framework. There is no wrapping occuring in the background.

## Example

To run the example project, clone the repo, and run `pod install` from the Example directory first.
Expand Down

0 comments on commit 7145f9f

Please sign in to comment.