From 468b02b81288611c12df5691ce18f5bbafe29841 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Fri, 25 Jan 2019 15:24:17 +0100 Subject: [PATCH] ios: adjust to latest Swift syntax --- ios/sdk/sdk.xcodeproj/project.pbxproj | 8 +++++--- .../src/picture-in-picture/DragGestureController.swift | 6 +++--- ios/sdk/src/picture-in-picture/PiPViewCoordinator.swift | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/ios/sdk/sdk.xcodeproj/project.pbxproj b/ios/sdk/sdk.xcodeproj/project.pbxproj index ab1858d37..10a8e5060 100644 --- a/ios/sdk/sdk.xcodeproj/project.pbxproj +++ b/ios/sdk/sdk.xcodeproj/project.pbxproj @@ -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; }; diff --git a/ios/sdk/src/picture-in-picture/DragGestureController.swift b/ios/sdk/src/picture-in-picture/DragGestureController.swift index 2e27904ad..88f9e27ab 100644 --- a/ios/sdk/src/picture-in-picture/DragGestureController.swift +++ b/ios/sdk/src/picture-in-picture/DragGestureController.swift @@ -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 diff --git a/ios/sdk/src/picture-in-picture/PiPViewCoordinator.swift b/ios/sdk/src/picture-in-picture/PiPViewCoordinator.swift index e93544098..659635b2a 100644 --- a/ios/sdk/src/picture-in-picture/PiPViewCoordinator.swift +++ b/ios/sdk/src/picture-in-picture/PiPViewCoordinator.swift @@ -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