Quellcode durchsuchen

ios: adjust to latest Swift syntax

master
Saúl Ibarra Corretgé vor 6 Jahren
Ursprung
Commit
468b02b812

+ 5
- 3
ios/sdk/sdk.xcodeproj/project.pbxproj Datei anzeigen

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

+ 3
- 3
ios/sdk/src/picture-in-picture/DragGestureController.swift Datei anzeigen

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

+ 1
- 1
ios/sdk/src/picture-in-picture/PiPViewCoordinator.swift Datei anzeigen

202
         }
202
         }
203
 
203
 
204
         // resize to suggested ratio and position to the bottom right
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
         let size = CGSize(width: bounds.size.width * pipSizeRatio,
206
         let size = CGSize(width: bounds.size.width * pipSizeRatio,
207
                           height: bounds.size.height * pipSizeRatio)
207
                           height: bounds.size.height * pipSizeRatio)
208
         let x: CGFloat = adjustedBounds.maxX - size.width
208
         let x: CGFloat = adjustedBounds.maxX - size.width

Laden…
Abbrechen
Speichern