Skip to content

Commit d290771

Browse files
committed
update to swift 3
1 parent 408fdb8 commit d290771

File tree

7 files changed

+45
-27
lines changed

7 files changed

+45
-27
lines changed

EFIntroVideoViewController.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
Pod::Spec.new do |s|
1010
s.name = 'EFIntroVideoViewController'
11-
s.version = '0.0.2'
11+
s.version = '0.0.4'
1212
s.summary = 'A very simple IBDesignable Video Intro ViewController.'
1313

1414
# This description is used to generate tags and improve search results.

EFIntroVideoViewController/Classes/EFIntroVideoViewController.swift

+10-10
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class EFIntroVideoViewController: UIViewController {
3838
loadVideo()
3939
}
4040

41-
private func loadVideo() {
41+
fileprivate func loadVideo() {
4242

4343
playerView = UIView(frame: view.bounds)
4444

@@ -49,27 +49,27 @@ class EFIntroVideoViewController: UIViewController {
4949
fatalError()
5050
}
5151

52-
let path = NSBundle.mainBundle().pathForResource(videoPath, ofType:videoType)
53-
player = AVPlayer(URL: NSURL(fileURLWithPath: path!))
52+
let path = Bundle.main.path(forResource: videoPath, ofType:videoType)
53+
player = AVPlayer(url: URL(fileURLWithPath: path!))
5454
playerLayer = AVPlayerLayer(player: player)
5555
playerLayer.frame = self.view.frame
5656
playerLayer.videoGravity = AVLayerVideoGravityResizeAspectFill
5757
playerLayer.zPosition = -1
5858
playerView.layer.addSublayer(playerLayer)
59-
player?.seekToTime(kCMTimeZero)
59+
player?.seek(to: kCMTimeZero)
6060
player?.play()
61-
NSTimer.scheduledTimerWithTimeInterval(videoTime, target: self, selector: #selector(openNextViewController), userInfo: nil, repeats: false)
61+
Timer.scheduledTimer(timeInterval: videoTime, target: self, selector: #selector(openNextViewController), userInfo: nil, repeats: false)
6262
}
6363

6464
func openNextViewController() {
65-
UIView.animateWithDuration(videoTransitionTime, animations: {
65+
UIView.animate(withDuration: videoTransitionTime, animations: {
6666
self.playerView.alpha = 0
67-
}) { (completed) in
67+
}, completion: { (completed) in
6868
let identifier = self.nextViewControllerIdentifier
6969
let storyboard = UIStoryboard(name: self.storyboardName, bundle: nil)
7070
self.playerView.removeFromSuperview()
71-
let next = storyboard.instantiateViewControllerWithIdentifier(identifier)
72-
self.presentViewController(next, animated: self.animated, completion: nil)
73-
}
71+
let next = storyboard.instantiateViewController(withIdentifier: identifier)
72+
self.present(next, animated: self.animated, completion: nil)
73+
})
7474
}
7575
}

Example/EFIntroVideoViewController.xcodeproj/project.pbxproj

+6
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,11 @@
218218
TargetAttributes = {
219219
607FACCF1AFB9204008FA782 = {
220220
CreatedOnToolsVersion = 6.3.1;
221+
LastSwiftMigration = 0800;
221222
};
222223
607FACE41AFB9204008FA782 = {
223224
CreatedOnToolsVersion = 6.3.1;
225+
LastSwiftMigration = 0800;
224226
TestTargetID = 607FACCF1AFB9204008FA782;
225227
};
226228
};
@@ -498,6 +500,7 @@
498500
MODULE_NAME = ExampleApp;
499501
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
500502
PRODUCT_NAME = "$(TARGET_NAME)";
503+
SWIFT_VERSION = 3.0;
501504
};
502505
name = Debug;
503506
};
@@ -511,6 +514,7 @@
511514
MODULE_NAME = ExampleApp;
512515
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
513516
PRODUCT_NAME = "$(TARGET_NAME)";
517+
SWIFT_VERSION = 3.0;
514518
};
515519
name = Release;
516520
};
@@ -530,6 +534,7 @@
530534
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
531535
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
532536
PRODUCT_NAME = "$(TARGET_NAME)";
537+
SWIFT_VERSION = 3.0;
533538
};
534539
name = Debug;
535540
};
@@ -545,6 +550,7 @@
545550
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
546551
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
547552
PRODUCT_NAME = "$(TARGET_NAME)";
553+
SWIFT_VERSION = 3.0;
548554
};
549555
name = Release;
550556
};

Example/EFIntroVideoViewController/AppDelegate.swift

+6-6
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,30 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
1414
var window: UIWindow?
1515

1616

17-
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
17+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
1818
// Override point for customization after application launch.
1919
return true
2020
}
2121

22-
func applicationWillResignActive(application: UIApplication) {
22+
func applicationWillResignActive(_ application: UIApplication) {
2323
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
2424
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
2525
}
2626

27-
func applicationDidEnterBackground(application: UIApplication) {
27+
func applicationDidEnterBackground(_ application: UIApplication) {
2828
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
2929
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
3030
}
3131

32-
func applicationWillEnterForeground(application: UIApplication) {
32+
func applicationWillEnterForeground(_ application: UIApplication) {
3333
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
3434
}
3535

36-
func applicationDidBecomeActive(application: UIApplication) {
36+
func applicationDidBecomeActive(_ application: UIApplication) {
3737
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
3838
}
3939

40-
func applicationWillTerminate(application: UIApplication) {
40+
func applicationWillTerminate(_ application: UIApplication) {
4141
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
4242
}
4343

Example/EFIntroVideoViewController/Base.lproj/Main.storyboard

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="Tjg-xO-S6R">
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11201" systemVersion="16A323" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="Tjg-xO-S6R">
33
<dependencies>
44
<deployment identifier="iOS"/>
5-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
5+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
6+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
67
</dependencies>
78
<scenes>
89
<!--Intro Video View Controller-->
@@ -14,9 +15,9 @@
1415
<viewControllerLayoutGuide type="bottom" id="6D7-IZ-nzK"/>
1516
</layoutGuides>
1617
<view key="view" contentMode="scaleToFill" id="glt-ZE-gpa">
17-
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
18+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
1819
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
19-
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
20+
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
2021
</view>
2122
<userDefinedRuntimeAttributes>
2223
<userDefinedRuntimeAttribute type="string" keyPath="storyboardName" value="Main"/>
@@ -45,17 +46,16 @@
4546
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
4647
</layoutGuides>
4748
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
48-
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
49+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
4950
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
5051
<subviews>
5152
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="First ViewController" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="BZq-wl-8MO">
52-
<rect key="frame" x="225" y="290" width="151" height="21"/>
5353
<fontDescription key="fontDescription" type="system" pointSize="17"/>
54-
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
54+
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
5555
<nil key="highlightedColor"/>
5656
</label>
5757
</subviews>
58-
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
58+
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
5959
<constraints>
6060
<constraint firstItem="BZq-wl-8MO" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="KOp-00-mKF"/>
6161
<constraint firstItem="BZq-wl-8MO" firstAttribute="centerY" secondItem="8bC-Xf-vdC" secondAttribute="centerY" id="buV-nl-Wdq"/>

Example/Pods/Pods.xcodeproj/project.pbxproj

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Tests/Tests.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Tests: XCTestCase {
2121

2222
func testPerformanceExample() {
2323
// This is an example of a performance test case.
24-
self.measureBlock() {
24+
self.measure() {
2525
// Put the code you want to measure the time of here.
2626
}
2727
}

0 commit comments

Comments
 (0)