Skip to content

Commit 2357aa6

Browse files
committed
[Update] to swfit 4.2
1 parent aba63bd commit 2357aa6

4 files changed

Lines changed: 23 additions & 15 deletions

File tree

Demo.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@
200200
files = (
201201
);
202202
inputPaths = (
203-
"${SRCROOT}/Pods/Target Support Files/Pods-Demo/Pods-Demo-frameworks.sh",
203+
"${PODS_ROOT}/Target Support Files/Pods-Demo/Pods-Demo-frameworks.sh",
204204
"${BUILT_PRODUCTS_DIR}/SemiModalViewController/SemiModalViewController.framework",
205205
);
206206
name = "[CP] Embed Pods Frameworks";
@@ -209,7 +209,7 @@
209209
);
210210
runOnlyForDeploymentPostprocessing = 0;
211211
shellPath = /bin/sh;
212-
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Demo/Pods-Demo-frameworks.sh\"\n";
212+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Demo/Pods-Demo-frameworks.sh\"\n";
213213
showEnvVarsInLog = 0;
214214
};
215215
92C885EEE249003944DFA33D /* [CP] Check Pods Manifest.lock */ = {
@@ -388,7 +388,7 @@
388388
PRODUCT_BUNDLE_IDENTIFIER = im.muyexi.Demo;
389389
PRODUCT_NAME = Demo;
390390
SWIFT_SWIFT3_OBJC_INFERENCE = On;
391-
SWIFT_VERSION = 4.0;
391+
SWIFT_VERSION = 4.2;
392392
TARGETED_DEVICE_FAMILY = "1,2";
393393
};
394394
name = Debug;
@@ -405,7 +405,7 @@
405405
PRODUCT_BUNDLE_IDENTIFIER = im.muyexi.Demo;
406406
PRODUCT_NAME = Demo;
407407
SWIFT_SWIFT3_OBJC_INFERENCE = On;
408-
SWIFT_VERSION = 4.0;
408+
SWIFT_VERSION = 4.2;
409409
TARGETED_DEVICE_FAMILY = "1,2";
410410
};
411411
name = Release;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

Demo/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
55

66
var window: UIWindow?
77

8-
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
8+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
99
return true
1010
}
1111

Source/UIViewController+SemiModalViewController.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ extension UIViewController {
4242
registerOptions(options)
4343
let targetParentVC = parentTargetViewController()
4444

45-
targetParentVC.addChildViewController(vc)
45+
targetParentVC.addChild(vc)
4646
vc.beginAppearanceTransition(true, animated: true)
4747

4848
objc_setAssociatedObject(targetParentVC, &semiModalViewController, vc, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
4949
objc_setAssociatedObject(targetParentVC, &semiModalDismissBlock, ClosureWrapper(closure: dismissBlock), .OBJC_ASSOCIATION_COPY_NONATOMIC)
5050

5151
presentSemiView(vc.view, options: options) {
52-
vc.didMove(toParentViewController: targetParentVC)
52+
vc.didMove(toParent: targetParentVC)
5353
vc.endAppearanceTransition()
5454

5555
completion?()
@@ -69,7 +69,7 @@ extension UIViewController {
6969

7070
NotificationCenter.default.addObserver(targetParentVC,
7171
selector: #selector(interfaceOrientationDidChange(_:)),
72-
name: .UIDeviceOrientationDidChange,
72+
name: UIDevice.orientationDidChangeNotification,
7373
object: nil)
7474

7575
let semiViewHeight = view.frame.size.height
@@ -192,7 +192,7 @@ extension UIViewController {
192192
let vc = objc_getAssociatedObject(targetVC, &semiModalViewController) as? UIViewController
193193
let dismissBlock = (objc_getAssociatedObject(targetVC, &semiModalDismissBlock) as? ClosureWrapper)?.closure
194194

195-
vc?.willMove(toParentViewController: nil)
195+
vc?.willMove(toParent: nil)
196196
vc?.beginAppearanceTransition(false, animated: true)
197197

198198
UIView.animate(withDuration: duration, animations: {
@@ -206,15 +206,15 @@ extension UIViewController {
206206
overlay.removeFromSuperview()
207207
modal.removeFromSuperview()
208208

209-
vc?.removeFromParentViewController()
209+
vc?.removeFromParent()
210210
vc?.endAppearanceTransition()
211211

212212
dismissBlock?()
213213

214214
objc_setAssociatedObject(targetVC, &semiModalDismissBlock, nil, .OBJC_ASSOCIATION_COPY_NONATOMIC)
215215
objc_setAssociatedObject(targetVC, &semiModalViewController, nil, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
216216

217-
NotificationCenter.default.removeObserver(targetVC, name: .UIDeviceOrientationDidChange, object: nil)
217+
NotificationCenter.default.removeObserver(targetVC, name: UIDevice.orientationDidChangeNotification, object: nil)
218218
})
219219

220220
if let screenshot = overlay.subviews.first {
@@ -255,19 +255,19 @@ extension UIViewController {
255255

256256
let duration = optionForKey(.animationDuration) as! Double
257257
animation.duration = duration / 2
258-
animation.fillMode = kCAFillModeForwards
258+
animation.fillMode = CAMediaTimingFillMode.forwards
259259
animation.isRemovedOnCompletion = false
260-
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseOut)
260+
animation.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeOut)
261261

262262
let animation2 = CABasicAnimation(keyPath: "transform")
263263
animation2.toValue = NSValue(caTransform3D: forward ? id2 : CATransform3DIdentity)
264264
animation2.beginTime = animation.duration
265265
animation2.duration = animation.duration
266-
animation2.fillMode = kCAFillModeForwards
266+
animation2.fillMode = CAMediaTimingFillMode.forwards
267267
animation2.isRemovedOnCompletion = false
268268

269269
let group = CAAnimationGroup()
270-
group.fillMode = kCAFillModeForwards
270+
group.fillMode = CAMediaTimingFillMode.forwards
271271
group.isRemovedOnCompletion = false
272272
group.duration = animation.duration * 2
273273
group.animations = [animation, animation2]

0 commit comments

Comments
 (0)