ios: adjust to latest Swift syntax

This commit is contained in:
Saúl Ibarra Corretgé 2019-01-25 15:24:17 +01:00 committed by Saúl Ibarra Corretgé
parent 3fa5aed950
commit 468b02b812
3 changed files with 9 additions and 7 deletions

View File

@ -291,7 +291,7 @@
TargetAttributes = {
0BD906E41EC0C00300C8C18E = {
CreatedOnToolsVersion = 8.3.2;
LastSwiftMigration = 0920;
LastSwiftMigration = 1010;
ProvisioningStyle = Automatic;
};
};
@ -614,7 +614,8 @@
SKIP_INSTALL = YES;
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
@ -640,7 +641,8 @@
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.2;
};
name = Release;
};

View File

@ -88,20 +88,20 @@ final class DragGestureController {
else { return CGPoint.zero }
let currentSize = view.frame.size
let adjustedBounds = UIEdgeInsetsInsetRect(bounds, insets)
let adjustedBounds = bounds.inset(by: insets)
let threshold: CGFloat = 20.0
let velocity = panGesture.velocity(in: view.superview)
let location = panGesture.location(in: view.superview)
let goLeft: Bool
if fabs(velocity.x) > threshold {
if abs(velocity.x) > threshold {
goLeft = velocity.x < -threshold
} else {
goLeft = location.x < bounds.midX
}
let goUp: Bool
if fabs(velocity.y) > threshold {
if abs(velocity.y) > threshold {
goUp = velocity.y < -threshold
} else {
goUp = location.y < bounds.midY

View File

@ -202,7 +202,7 @@ public class PiPViewCoordinator {
}
// resize to suggested ratio and position to the bottom right
let adjustedBounds = UIEdgeInsetsInsetRect(bounds, dragBoundInsets)
let adjustedBounds = bounds.inset(by: dragBoundInsets)
let size = CGSize(width: bounds.size.width * pipSizeRatio,
height: bounds.size.height * pipSizeRatio)
let x: CGFloat = adjustedBounds.maxX - size.width