Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
SvenTiigi committed Sep 18, 2018
2 parents a14638d + 84b81fc commit 05afdb0
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0
4.2
1 change: 0 additions & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ opt_in_rules: # some rules are only opt-in
- closure_spacing
- implicitly_unwrapped_optional
- sorted_imports
- missing_docs
- valid_docs

included:
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ notifications:
on_success: change
on_failure: always

osx_image: xcode9.3
osx_image: xcode10
language: swift

before_script:
Expand Down
2 changes: 1 addition & 1 deletion Configs/FlyoverKit.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</string>
<string>1.2.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion Configs/FlyoverKitTests.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.2.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion Example/Supporting Files/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.2.1</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
Expand Down
8 changes: 4 additions & 4 deletions FlyoverKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@
PRODUCT_NAME = FlyoverKit;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -852,7 +852,7 @@
PRODUCT_NAME = FlyoverKit;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand Down Expand Up @@ -902,7 +902,7 @@
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 10.0;
};
Expand All @@ -926,7 +926,7 @@
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 10.0;
};
Expand Down
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<p align="center">
<a href="https://developer.apple.com/swift/">
<img src="https://img.shields.io/badge/Swift-4.1-orange.svg?style=flat" alt="Swift 4.0">
<img src="https://img.shields.io/badge/Swift-4.2-orange.svg?style=flat" alt="Swift 4.2">
</a>
<a href="https://travis-ci.org/SvenTiigi/FlyoverKit">
<img src="https://travis-ci.org/SvenTiigi/FlyoverKit.svg?branch=master" alt="Build Status">
Expand All @@ -22,9 +22,6 @@
<a href="https://codeclimate.com/github/SvenTiigi/FlyoverKit/maintainability">
<img src="https://api.codeclimate.com/v1/badges/67fab45d0f3b1d232e67/maintainability" alt="Maintainability">
</a>
<a href="https://codeclimate.com/github/SvenTiigi/FlyoverKit/test_coverage">
<img src="https://api.codeclimate.com/v1/badges/67fab45d0f3b1d232e67/test_coverage" alt="Test Coverage">
</a>
<a href="https://sventiigi.github.io/FlyoverKit">
<img src="https://github.com/SvenTiigi/FlyoverKit/blob/gh-pages/badge.svg" alt="Documentation">
</a>
Expand Down
2 changes: 1 addition & 1 deletion Sources/Camera/FlyoverCamera+RegionChangeAnimation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public extension FlyoverCamera {
case none
/// Animation with given TimeInterval and AnimationCurve
/// should be performed
case animated(duration: TimeInterval, curve: UIViewAnimationCurve)
case animated(duration: TimeInterval, curve: UIView.AnimationCurve)
}

}
56 changes: 36 additions & 20 deletions Sources/Camera/FlyoverCamera.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ open class FlyoverCamera {
open var state: State

/// The animation curve
open let curve: UIViewAnimationCurve = .linear
open var curve: UIView.AnimationCurve = .linear

// MARK: Private properties

Expand Down Expand Up @@ -73,15 +73,15 @@ open class FlyoverCamera {
// Add application will resign active observer
NotificationCenter.default.addObserver(
self,
selector: #selector(applicationWillResignActive),
name: .UIApplicationWillResignActive,
selector: #selector(self.applicationWillResignActive),
name: UIApplication.willResignActiveNotification,
object: nil
)
// Add application did become active observer
NotificationCenter.default.addObserver(
self,
selector: #selector(applicationDidBecomeActive),
name: .UIApplicationDidBecomeActive,
selector: #selector(self.applicationDidBecomeActive),
name: UIApplication.didBecomeActiveNotification,
object: nil
)
}
Expand Down Expand Up @@ -125,14 +125,20 @@ open class FlyoverCamera {
let startAnimator = UIViewPropertyAnimator(
duration: duration,
curve: curve,
animations: {
animations: { [weak self] in
// Verify self is available
guard let strongSelf = self else {
// Self isn't available return out of function
return
}
// Set MapView Camera
self.mapView?.camera = self.mapCamera
})
strongSelf.mapView?.camera = strongSelf.mapCamera
}
)
// Add completion
startAnimator.setCompletion {
startAnimator.setCompletion { [weak self] in
// Start rotation
self.performFlyover(flyover)
self?.performFlyover(flyover)
}
// Start animation
startAnimator.startAnimation()
Expand Down Expand Up @@ -165,15 +171,20 @@ open class FlyoverCamera {
self.animator = UIViewPropertyAnimator(
duration: 0,
curve: self.curve,
animations: {
animations: { [weak self] in
// Verify self is available
guard let strongSelf = self else {
// Self isn't available return out of function
return
}
// Substract the headingStep from current heading to retrieve start value
heading -= self.configuration.headingStep
heading -= strongSelf.configuration.headingStep
// Initialize the percentage of the compeleted heading step
let percentageCompletedHeadingStep = Double(fractionComplete) * self.configuration.headingStep
let percentageCompletedHeadingStep = Double(fractionComplete) * strongSelf.configuration.headingStep
// Set MapCamera Heading
self.mapCamera.heading = fmod(heading + percentageCompletedHeadingStep, 360)
strongSelf.mapCamera.heading = fmod(heading + percentageCompletedHeadingStep, 360)
// Set MapView Camera
self.mapView?.camera = self.mapCamera
strongSelf.mapView?.camera = strongSelf.mapCamera
})
// Start animation
self.animator?.startAnimation()
Expand All @@ -198,16 +209,21 @@ open class FlyoverCamera {
self.animator = UIViewPropertyAnimator(
duration: self.configuration.duration,
curve: self.curve,
animations: {
animations: { [weak self] in
// Verify self is available
guard let strongSelf = self else {
// Self isn't available return out of function
return
}
// Update MapViewCamera
self.mapView?.camera = self.mapCamera
strongSelf.mapView?.camera = strongSelf.mapCamera
})
// Add completion
self.animator?.setCompletion {
self.animator?.setCompletion { [weak self] in
// Check if flyovers are nearly equal
if self.flyover ~~ flyover {
if self?.flyover ~~ flyover {
// Invoke recursion
self.performFlyover(flyover)
self?.performFlyover(flyover)
}
}
// Start Animation
Expand Down
7 changes: 1 addition & 6 deletions Sources/Flyover.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,7 @@ extension MKMapView: Flyover {
return self.centerCoordinate
}
}
extension MKMapPoint: Flyover {
/// The flyover coordinate
public var coordinate: CLLocationCoordinate2D {
return MKCoordinateForMapPoint(self)
}
}
extension MKMapPoint: Flyover {}
extension MKCoordinateRegion: Flyover {
/// The flyover coordinate
public var coordinate: CLLocationCoordinate2D {
Expand Down
1 change: 1 addition & 0 deletions Sources/MapView/FlyoverMapView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ open class FlyoverMapView: MKMapView {

/// Stop Flyover
open func stop() {
// Stop FlyoverCamera
self.flyoverCamera.stop()
// Enable userInteraction
self.isUserInteractionEnabled = true
Expand Down

0 comments on commit 05afdb0

Please sign in to comment.