Skip to content

Commit

Permalink
Merge branch 'release/1.0.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
malcommac committed Sep 8, 2016
2 parents d5248f9 + 5d93848 commit cdc1c5a
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 30 deletions.
41 changes: 14 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ It's really easy to use and it's compatible both with Swift 2.2, 2.3 and 3.0.

Pick the right version:

- Official **Swift 2.2** is in master (and develop)
- **Swift 2.3** branch is [here](https://github.com/malcommac/SwiftLocation/tree/feature/swift2.3).
- **Swift 3.0** branch is [here](https://github.com/malcommac/SwiftLocation/tree/swift-3.0).
- Old unsupported **Swift 2.0** branch is [here](https://github.com/malcommac/SwiftLocation/tree/swift-2.0)
- **Swift 3.0** is in master (and develop) (CocoaPods Tag >= 1.0.6)
- Old **Swift 2.2** branch is [here](https://github.com/malcommac/SwiftLocation/tree/swift-2.2). (CocoaPods Tag = 1.0.5)
- Old **Swift 2.3** branch is [here](https://github.com/malcommac/SwiftLocation/tree/feature/swift2.3).
- Old **Swift 2.0** branch is [here](https://github.com/malcommac/SwiftLocation/tree/swift-2.0)

Main features includes:

Expand All @@ -43,28 +43,6 @@ If you need background monitoring you should specify ```NSLocationAlwaysUsageDes

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 [email protected].

From SwiftLocation 0.x to 1.0
-------
Several changes are made from 0.x branch to 1.0 especially from the side of the location manager.
It's pretty easy to align your project with this news version.
Since 1.0 we will keep the API stable and any change will use @available metatag of Swift to keep you in track.

Changes are:

#### Renamed Methods
- ```LocationManager.shared.``` is now replaced by ```Location.```
- ```BeaconManager.shared.``` is now replaced by ```Beacon.```
- Each request is conform to ```Request``` protocol. Where allowed you can use ```start()```, ```pause()``` or ```cancel()``` a running request.
- ```observeLocations()``` is now replaced with ```getLocation()``` (and it allows you to specify a custom timeout)
- ```observeInterestingPlaces()``` is now replaced with ```getInterestingPlaces()```
- Reverse geocoding services are now under the ```reverse``` function umbrella (```reverse(location:...), reverse(address:... and reverse(coordinates:...)```)

#### Other Changes
- ```Accuracy``` now include IP Address Scan (```.IPScan```) to get the current location (```locateByIPAddress()``` was removed). It works as usual, without asking sensor authorization to the user.
- ```observeHeading()``` is now replaced with ```getHeading```. Heading services now works correctly and allow you to specify a frequency (```HeadingFrequency```: ```.Continous(interval)``` to receive new heading at specified time intervals; ```.TrueNorth(minDegree)``` and ```.MagneticNorth(minDegree)``` allows you to receive events only when a specified deviation from the last catched heading is reported).
- ```HeadingRequest``` has now a ```allowsCalibration``` property instead of a ```onCalibrationRequired()``` function.
- ```onSuccess``` handler in ```HeadingRequest``` is now ```onReceiveUpdates```

Documentation
-------

Expand Down Expand Up @@ -335,6 +313,10 @@ request.onAuthorizationDidChange = { newStatus in
Changes
-------

### Version 1.0.5 (2016/09/09):
- Request's cancel() function now has error as optional argument
- **This is the last Swift 2.2 version**

### Version 1.0.4 (2016/08/31):
- Added support for ip-api Pro API Key
- Added documentation reference for ip-api limit usage, pro version and app transport security on iOS 9 or later.
Expand Down Expand Up @@ -380,10 +362,15 @@ platform :ios, '9.0'
use_frameworks!
target '<Your Target Name>' do
pod 'SwiftLocation', '~> 1.0'
pod 'SwiftLocation', '~> 1.0.5'
end
```

Swift Versions:

- **Swift 2.2** ```pod 'SwiftLocation', '1.0.5'```
- **Swift 3** ```pod 'SwiftLocation', '>= 1.0.6'```

Then, run the following command:

```
Expand Down
2 changes: 1 addition & 1 deletion SwiftLocation.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'SwiftLocation'
s.version = '1.0.4'
s.version = '1.0.5'
s.license = 'MIT'
s.summary = 'Elegant Location Services and Beacon Monitoring in Swift'
s.homepage = 'https://github.com/malcommac/SwiftLocation'
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion SwiftLocation/SwiftLocation/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0.4</string>
<string>1.0.5</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
7 changes: 7 additions & 0 deletions src/BeaconAdvertiseRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ public class BeaconAdvertiseRequest: NSObject, Request {
}
}

/**
Terminate request without errors
*/
public func cancel() {
self.cancel(nil)
}

public func pause() {
if self.rState.isRunning == true {
Beacons.stopAdvertise(self.name, error: nil)
Expand Down
7 changes: 7 additions & 0 deletions src/BeaconRegionRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ public class BeaconRegionRequest: NSObject, Request {
Beacons.remove(request: self, error: error)
}

/**
Terminate request without errors
*/
public func cancel() {
self.cancel(nil)
}

public func pause() {
if Beacons.remove(request: self) == true {
self.rState = .Paused
Expand Down
15 changes: 14 additions & 1 deletion src/Commons.swift
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ extension CLGeocoder: Request {
cancelGeocode()
}

public func cancel() {
cancelGeocode()
}

public func pause() {
// not available
}
Expand Down Expand Up @@ -213,6 +217,12 @@ public protocol Request {
*/
func cancel(error: LocationError?)

/**
Cancel an operation without passing an error.
Woraround because we cannot have default value for a protocol param
*/
func cancel()

/**
Pause a running request
*/
Expand Down Expand Up @@ -321,6 +331,7 @@ public enum LocationError: ErrorType, CustomStringConvertible {
case NoDataReturned
case NotSupported
case InvalidBeaconData
case Forced

public var description: String {
switch self {
Expand All @@ -344,6 +355,8 @@ public enum LocationError: ErrorType, CustomStringConvertible {
return "Feature Not Supported"
case .InvalidBeaconData:
return "Cannot create monitor for beacon. Invalid data"
case .Forced:
return "Request Manually Cancelled"
}
}
}
Expand Down Expand Up @@ -572,4 +585,4 @@ public enum HeadingFrequency {
case Continuous(interval: NSTimeInterval?)
case MagneticNorth(minChange: CLLocationDirection)
case TrueNorth(minChange: CLLocationDirection)
}
}
7 changes: 7 additions & 0 deletions src/GeoRegionRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ public class GeoRegionRequest: NSObject, Request {
Beacons.remove(request: self, error: error)
}

/**
Terminate request without errors
*/
public func cancel() {
self.cancel(nil)
}

public func pause() {
if Beacons.remove(request: self) == true {
self.rState = .Paused
Expand Down
7 changes: 7 additions & 0 deletions src/HeadingRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,13 @@ public class HeadingRequest: Request {
}
}

/**
Terminate request without errors
*/
public func cancel() {
self.cancel(nil)
}

//MARK: - Private

internal func didReceiveEventFromManager(error: NSError?, heading: CLHeading?) {
Expand Down
7 changes: 7 additions & 0 deletions src/LocationRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,13 @@ public class LocationRequest: Request {
}
}

/**
Terminate request without errors
*/
public func cancel() {
self.cancel(nil)
}

/**
Temporary pauses receiving updates for this request. Request is not removed from the queue and you can resume it using start()
*/
Expand Down
4 changes: 4 additions & 0 deletions src/VisitRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ public class VisitRequest: Request {
}
}

public func cancel() {
self.cancel(nil)
}

public func pause() {
if self.rState.isRunning {
self.rState = .Paused
Expand Down

0 comments on commit cdc1c5a

Please sign in to comment.