Browse Source

ios: adjust to latest Swift syntax

master
Saúl Ibarra Corretgé 6 years ago
parent
commit
468b02b812

+ 5
- 3
ios/sdk/sdk.xcodeproj/project.pbxproj View File

@@ -291,7 +291,7 @@
291 291
 				TargetAttributes = {
292 292
 					0BD906E41EC0C00300C8C18E = {
293 293
 						CreatedOnToolsVersion = 8.3.2;
294
-						LastSwiftMigration = 0920;
294
+						LastSwiftMigration = 1010;
295 295
 						ProvisioningStyle = Automatic;
296 296
 					};
297 297
 				};
@@ -614,7 +614,8 @@
614 614
 				SKIP_INSTALL = YES;
615 615
 				SWIFT_OBJC_BRIDGING_HEADER = "";
616 616
 				SWIFT_OPTIMIZATION_LEVEL = "-Onone";
617
-				SWIFT_VERSION = 3.0;
617
+				SWIFT_SWIFT3_OBJC_INFERENCE = On;
618
+				SWIFT_VERSION = 4.2;
618 619
 			};
619 620
 			name = Debug;
620 621
 		};
@@ -640,7 +641,8 @@
640 641
 				PROVISIONING_PROFILE_SPECIFIER = "";
641 642
 				SKIP_INSTALL = YES;
642 643
 				SWIFT_OBJC_BRIDGING_HEADER = "";
643
-				SWIFT_VERSION = 3.0;
644
+				SWIFT_SWIFT3_OBJC_INFERENCE = On;
645
+				SWIFT_VERSION = 4.2;
644 646
 			};
645 647
 			name = Release;
646 648
 		};

+ 3
- 3
ios/sdk/src/picture-in-picture/DragGestureController.swift View File

@@ -88,20 +88,20 @@ final class DragGestureController {
88 88
             else { return CGPoint.zero }
89 89
 
90 90
         let currentSize = view.frame.size
91
-        let adjustedBounds = UIEdgeInsetsInsetRect(bounds, insets)
91
+        let adjustedBounds = bounds.inset(by: insets)
92 92
         let threshold: CGFloat = 20.0
93 93
         let velocity = panGesture.velocity(in: view.superview)
94 94
         let location = panGesture.location(in: view.superview)
95 95
 
96 96
         let goLeft: Bool
97
-        if fabs(velocity.x) > threshold {
97
+        if abs(velocity.x) > threshold {
98 98
             goLeft = velocity.x < -threshold
99 99
         } else {
100 100
             goLeft = location.x < bounds.midX
101 101
         }
102 102
 
103 103
         let goUp: Bool
104
-        if fabs(velocity.y) > threshold {
104
+        if abs(velocity.y) > threshold {
105 105
             goUp = velocity.y < -threshold
106 106
         } else {
107 107
             goUp = location.y < bounds.midY

+ 1
- 1
ios/sdk/src/picture-in-picture/PiPViewCoordinator.swift View File

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

Loading…
Cancel
Save