Permalink
Browse files

Updated README

  • Loading branch information...
1 parent b7e407a commit 046b619fc35b70144aecf568a5638c48a7d2d9de @weibel committed Aug 22, 2012
Showing with 217 additions and 9 deletions.
  1. +217 −9 README.md
View
@@ -37,9 +37,71 @@ def loadView
end
```
-## Wrappers for the Core Location Data Types
+## MapView: Wrapper for MKMapView
-Include the classes
+Include the module
+```ruby
+include MapKit
+```
+
+Initializer
+
+```ruby
+MapView.new
+```
+
+### Methods on MapView
+
+Zoom methods
+
+```ruby
+>> map = MapView.new
+=> MapView
+>> map.zoom_enabled?
+=> false
+>> map.zoom_enabled = true
+=> true
+```
+
+Scroll methods
+
+```ruby
+>> map = MapView.new
+=> MapView
+>> map.scroll_enabled?
+=> false
+>> map.scroll_enabled = true
+=> true
+```
+
+Location methods
+
+Check if the users location has been found
+```ruby
+>> map.user_located?
+=> false
+
+>> map.shows_user_location?
+=> false
+
+>> map.user_coordinates
+=> nil
+
+>> map.shows_user_location = true
+=> true
+
+# wait for a bit
+
+>> map.user_located?
+=> true
+
+>> map.user_coordinates
+=> LocationCoordinate
+```
+
+## Wrappers for the CoreLocation data types
+
+Include the module
```ruby
include CoreLocation::DataTypes
```
@@ -56,7 +118,7 @@ LocationCoordinate.new(CLLocationCoordinate2D)
Methods on `LocationCoordinate`
```ruby
->> lc = LocationCoordinate.new(1,2)
+>> lc = LocationCoordinate.new(1, 2)
=> [1, 2]
>> lc.latitude
@@ -76,13 +138,159 @@ Methods on `LocationCoordinate`
=> CLLocationCoordinate2D
```
+## Wrappers for the MapKit data types
+
+Include the module
+
+```ruby
+include MapKit::DataTypes
+```
+
+### CoordinateSpan: The wrapper for MKCoordinateSpan
+
+The `CoordinateSpan` initializer takes a variety of argument types
+
+```ruby
+CoordinateSpan.new(1, 2)
+CoordinateSpan.new([1, 2])
+CoordinateSpan.new(MKCoordinateSpan)
+```
+
+Methods on `CoordinateSpan`
+
+```ruby
+>> cs = CoordinateSpan.new(1, 2)
+=> [1, 2]
+
+>> cs.latitude_delta
+=> 1
+
+>> cs.longitude_delta
+=> 2
+
+>> cs.to_array
+=> [1, 2]
+
+>> cs.sdk
+=> MKCoordinateSpan
+```
+
+### CoordinateRegion: The wrapper for MKCoordinateRegion
+
+The `CoordinateRegion` initializer takes a variety of argument types
+
+```ruby
+CoordinateRegion.new(CoordinateRegion)
+CoordinateRegion.new(MKCoordinateRegion)
+CoordinateRegion.new([56, 10.6], [3.1, 3.1])
+CoordinateRegion.new(LocationCoordinate, CoordinateSpan)
+CoordinateRegion.new(CLLocationCoordinate2D, MKCoordinateSpan)
+```
+
+Methods on `CoordinateRegion`
+
+```ruby
+>> cr = CoordinateRegion.new([56, 10.6], [3.1, 5.1])
+=> {:center => [56, 10.6], :span => [3.1, 5.1]}
+
+>> cs.center
+=> LocationCoordinate([56, 10.6])
+
+>> cs.region
+=> CoordinateSpan([3.1, 5.1])
+
+>> cs.to_hash
+=> {:center => [56, 10.6], :span => [3.1, 5.1]}
+
+>> cs.sdk
+=> MKCoordinateRegion
+```
+
+### MapPoint: The wrapper for MKMapPoint
+
+The `MapPoint` initializer takes a variety of argument types
+
+```ruby
+MapPoint.new(50, 45)
+MapPoint.new([50, 45])
+MapPoint.new(MKMapPoint)
+```
+
+Methods on `MapPoint`
+
+```ruby
+>> mp = MapPoint.new(50, 45)
+=> [50, 45]
+
+>> mp.x
+=> 50
+
+>> mp.y
+=> 45
+
+>> mp.to_array
+=> [50, 45]
+
+>> mp.sdk
+=> MKMapPoint
+```
+
+### MapSize: The wrapper for MKMapSize
+
+The `MapSize` initializer takes a variety of argument types
-Check if the users location has been found
```ruby
-@map.user_located?
-```
-Get the users coordinates
+MapSize.new(10, 12)
+MapSize.new([10, 12])
+MapSize.new(MKMapSize)
+```
+
+Methods on `MapSize`
+
```ruby
-@map.user_coordinates
-```
+>> ms = MapSize.new(10, 12)
+=> [10, 12]
+
+>> ms.width
+=> 10
+
+>> ms.height
+=> 12
+
+>> ms.to_array
+=> [50, 45]
+
+>> ms.sdk
+=> MKMapSize
+```
+
+### MapRect: The wrapper for MKMapRect
+
+The `MapRect` initializer takes a variety of argument types
+
+```ruby
+MapRect.new(x, y, width, height)
+MapRect.new([x, y], [width, height])
+MapRect.new(MapPoint, MapSize)
+MapRect.new(MKMapPoint, MKMapSize)
+```
+
+Methods on `MapRect`
+
+```ruby
+>> mr = MapRect.new(2, 3, 10, 12)
+=> {:origin => [2, 3], :size => [10, 12]}
+
+>> mr.origin
+=> MapRect([2, 3])
+
+>> mr.size
+=> MapSize([10, 12])
+
+>> mr.to_hash
+=> {:origin => [2, 3], :size => [10, 12]}
+
+>> mr.sdk
+=> MKMapRect
+```

0 comments on commit 046b619

Please sign in to comment.