You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10-78Lines changed: 10 additions & 78 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@
12
12
<palign="center" >★★ <b>Star our github repository to help us!</b> ★★</p>
13
13
14
14
# SwiftLocation
15
-
SwiftLocation is a lightweight library you can use to monitor locations, make reverse geocoding (both with Apple and Google's services) monitor beacons and do beacon advertising.
15
+
SwiftLocation is a lightweight library you can use to monitor locations, make reverse geocoding (both with Apple and Google's services) and more!
16
16
It's really easy to use and it's compatible both with Swift 2.2, 2.3 and 3.0.
17
17
18
18
★★ Star our GitHub repository to help us! ★★
@@ -24,6 +24,11 @@ Pick the right version:
24
24
- Old/Unsupported **Swift 2.3** branch is [here](https://github.com/malcommac/SwiftLocation/tree/feature/swift2.3).
25
25
- Old/Unsupported **Swift 2.0** branch is [here](https://github.com/malcommac/SwiftLocation/tree/swift-2.0)
26
26
27
+
### Bluetooth Support
28
+
Bluetooth support was removed temporary since 1.2.0.
29
+
We will restore it later or in another subspecs/library.
30
+
If you are using BT monitoring please use 1.1.1 version from CocoaPods.
31
+
27
32
Main features includes:
28
33
29
34
-**Auto Management of hardware resources**: SwiftLocation turns off hardware if not used by our observers. Don't worry, we take care of your user's battery usage!
@@ -32,8 +37,6 @@ Main features includes:
32
37
-**Reverse geocoding** (from address string/coordinates to placemark) using both Apple and Google services (with support for API key)
33
38
-**GPS-less location fetching** using network IP address
34
39
-**Geographic region** monitoring (enter/exit from regions)
35
-
-**Beacon Family and Beacon** monitoring
36
-
-**Set a device to act like a Beacon** (only in foreground)
37
40
38
41
### Pre-requisites
39
42
@@ -44,7 +47,7 @@ If you need background monitoring you should specify ```NSLocationAlwaysUsageDes
44
47
45
48
### SwiftLocation in your next big project? Tell it to me!
46
49
47
-
I'm collecting all the apps which uses SwiftLocation to manage beacon or location. If you are using SwiftLocation in your project please fill a PR to this file or send an email to hello@danielemargutti.com.
50
+
I'm collecting all the apps which uses SwiftLocation to manage location. If you are using SwiftLocation in your project please fill a PR to this file or send an email to hello@danielemargutti.com.
48
51
49
52
Documentation
50
53
-------
@@ -55,8 +58,6 @@ Documentation
55
58
***[Reverse Address/Coordinates to CLPlacemark](#reverseAddressSaample)**
@@ -223,78 +224,6 @@ Location.getInterestingPlaces { newVisit in
223
224
}
224
225
```
225
226
226
-
([Documentation ↑](#documentation))
227
-
<aname="monitorGepRegSample" />
228
-
## Monitor Geographic Regions
229
-
You can easily to be notified when the user crosses a region based boundary.
230
-
You use region monitoring to detect boundary crossings of the specified region and you use those boundary crossings to perform related tasks. For example, upon approaching a dry cleaners, an app could notify the user to pick up any clothes that had been dropped off and are now ready.
231
-
232
-
SwiftLocation offers to you a simple method called ```monitor()``` to get notified about these kind of events:
233
-
234
-
```swift
235
-
// Define a geographic circle region
236
-
let centerPoint =CLLocationCoordinate2DMake(0, 0)
237
-
let radius =CLLocationDistance(100)
238
-
do {
239
-
// Attempt to monitor the region
240
-
let request =try Beacons.monitor(geographicRegion: centerPoint, radius: radius, onStateDidChange: { newState in
241
-
// newState is .Entered if user entered into the region defined by the center point and the radius or .Exited if it move away from the region.
242
-
}) { error in
243
-
// something bad has happened
244
-
}
245
-
} catchleterr {
246
-
// Failed to initialize region (bad region, monitor is not supported by the hardware etc.)
247
-
print("Cannot monitor region due to an error: \(err)")
248
-
}
249
-
```
250
-
251
-
Usually you can ```pause()```/```start()``` or ```cancel()``` the request itself; just keep a reference to it.
252
-
253
-
([Documentation ↑](#documentation))
254
-
<aname="monitoriBeacon" />
255
-
## Monitor Beacons
256
-
257
-
You can easily to be notified when the user crosses a region defined by a beacon or get notified when users did found one or more beacons nearby.
258
-
259
-
Just use ```monitor()``` function:
260
-
261
-
```swift
262
-
let b_proximity ="00194D5B-0A08-4697-B81C-C9BDE117412E"
263
-
// You can omit major and minor to get notified about the entire beacon family defined by b_proximity
264
-
let b_major =CLBeaconMajorValue(64224)
265
-
let b_minor =CLBeaconMinorValue(43514)
266
-
267
-
do {
268
-
// Just create a Beacon structure which represent our beacon
269
-
let beacon =Beacon(proximity: proximity, major: major, minor: minor)
270
-
// Attempt to monitor beacon
271
-
try Beacons.monitor(beacon: beacon, events: Event.RegionBoundary, onStateDidChange: { state in
272
-
// events called when user crosses the boundary the region defined by passed beacon
273
-
}, onRangingBeacons: { visibleBeacons in
274
-
// events is fired countinously to get the list of visible beacons (with observed beacon) nearby
275
-
}, onError: { error in
276
-
// something went wrong. request is cancelled.
277
-
})
278
-
} catchleterr {
279
-
// failed to monitor beacon
280
-
}
281
-
```
282
-
([Documentation ↑](#documentation))
283
-
<aname="actLikeiBeacon" />
284
-
## Act like a Beacon
285
-
286
-
You can set your device to act like a beacon (this feature works only in foreground due to some limitations of Apple's own methods).
287
-
288
-
Keep in mind: advertising not works in background.
0 commit comments