Skip to content

Commit

Permalink
Merge pull request aslanyanhaik#17 from rrulin/Master
Browse files Browse the repository at this point in the history
Migrated to Swift 4
  • Loading branch information
aslanyanhaik authored Oct 23, 2017
2 parents 4b1d1c0 + e0e96c1 commit be06278
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 12 deletions.
21 changes: 18 additions & 3 deletions YouTube.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,14 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0800;
LastUpgradeCheck = 0830;
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = "Haik Aslanyan";
TargetAttributes = {
22AA44621D1302FB00CA6185 = {
CreatedOnToolsVersion = 8.0;
DevelopmentTeam = P6GDVV24N5;
DevelopmentTeamName = "Haik Aslanyan (Personal Team)";
LastSwiftMigration = 0900;
ProvisioningStyle = Automatic;
};
};
Expand Down Expand Up @@ -254,15 +255,21 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -303,15 +310,21 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -348,7 +361,8 @@
PRODUCT_BUNDLE_IDENTIFIER = com.haik.YouTube;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 1;
};
name = Debug;
Expand All @@ -365,7 +379,8 @@
PRODUCT_BUNDLE_IDENTIFIER = com.haik.YouTube;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 1;
};
name = Release;
Expand Down
2 changes: 1 addition & 1 deletion YouTube/Extensions/extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ extension MutableCollection where Index == Int {
for i in startIndex ..< endIndex - 1 {
let j = Int(arc4random_uniform(UInt32(endIndex - i))) + i
if i != j {
swap(&self[i], &self[j])
self.swapAt(i, j)
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions YouTube/Supporting views/PlayerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class PlayerView: UIView, UITableViewDelegate, UITableViewDataSource, UIGestureR
self.player.transform = trasform
}

func tapPlayView() {
@objc func tapPlayView() {
self.videoPlayer.play()
self.state = .fullScreen
self.delegate?.didmaximize()
Expand Down Expand Up @@ -180,7 +180,7 @@ class PlayerView: UIView, UITableViewDelegate, UITableViewDataSource, UIGestureR
weakSelf.videoPlayer = AVPlayer.init(url: weakSelf.video.videoLink)
let playerLayer = AVPlayerLayer.init(player: weakSelf.videoPlayer)
playerLayer.frame = weakSelf.player.frame
playerLayer.videoGravity = AVLayerVideoGravityResizeAspectFill
playerLayer.videoGravity = AVLayerVideoGravity.resizeAspectFill

weakSelf.player.layer.addSublayer(playerLayer)
if weakSelf.state != .hidden {
Expand Down
2 changes: 1 addition & 1 deletion YouTube/Supporting views/TabBarView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class TabBarView: UIView, UICollectionViewDelegateFlowLayout, UICollectionViewDa
NotificationCenter.default.addObserver(self, selector: #selector(self.animateMenu(notification:)), name: Notification.Name.init(rawValue: "scrollMenu"), object: nil)
}

func animateMenu(notification: Notification) {
@objc func animateMenu(notification: Notification) {
if let info = notification.userInfo {
let userInfo = info as! [String: CGFloat]
self.whiteBarLeadingConstraint.constant = self.whiteBar.bounds.width * userInfo["length"]!
Expand Down
4 changes: 2 additions & 2 deletions YouTube/ViewControllers/MainVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ class MainVC: UIViewController, UICollectionViewDataSource, UICollectionViewDele
NotificationCenter.default.addObserver(self, selector: #selector(self.hideBar(notification:)), name: NSNotification.Name("hide"), object: nil)
}

func scrollViews(notification: Notification) {
@objc func scrollViews(notification: Notification) {
if let info = notification.userInfo {
let userInfo = info as! [String: Int]
self.collectionView.scrollToItem(at: IndexPath.init(row: userInfo["index"]!, section: 0), at: .centeredHorizontally, animated: true)
}
}

func hideBar(notification: NSNotification) {
@objc func hideBar(notification: NSNotification) {
let state = notification.object as! Bool
self.navigationController?.setNavigationBarHidden(state, animated: true)
}
Expand Down
6 changes: 3 additions & 3 deletions YouTube/ViewControllers/NavVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class NavVC: UINavigationController, PlayerVCDelegate {
NotificationCenter.default.addObserver(self, selector: #selector(self.changeTitle(notification:)), name: Notification.Name.init(rawValue: "scrollMenu"), object: nil)
}

func showSearch() {
@objc func showSearch() {
self.searchView.alpha = 0
self.searchView.isHidden = false
UIView.animate(withDuration: 0.2, animations: {
Expand All @@ -117,7 +117,7 @@ class NavVC: UINavigationController, PlayerVCDelegate {
}
}

func showSettings() {
@objc func showSettings() {
self.settingsView.isHidden = false
self.settingsView.tableViewBottomConstraint.constant = 0
UIView.animate(withDuration: 0.3) {
Expand All @@ -126,7 +126,7 @@ class NavVC: UINavigationController, PlayerVCDelegate {
}
}

func changeTitle(notification: Notification) {
@objc func changeTitle(notification: Notification) {
if let info = notification.userInfo {
let userInfo = info as! [String: CGFloat]
self.titleLabel.text = self.names[Int(round(userInfo["length"]!))]
Expand Down

0 comments on commit be06278

Please sign in to comment.