diff --git a/YouTube/Helpers/GlobalVariables.swift b/YouTube/Helpers/GlobalVariables.swift old mode 100644 new mode 100755 index a59d98f..2174541 --- a/YouTube/Helpers/GlobalVariables.swift +++ b/YouTube/Helpers/GlobalVariables.swift @@ -18,8 +18,8 @@ struct globalVariables { static let subscriptionsLink = URL.init(string: "http://mexonis.com/subscriptions.json")! static let profileLink = URL.init(string: "http://mexonis.com/profile.json")! static let videoLink = URL.init(string: "http://mexonis.com/video.json")! - static let rect = CGRect.init(x: 0, y: 0, width: UIScreen.main().bounds.width, height: 44) - static let width = UIScreen.main().bounds.width + static let rect = CGRect.init(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 44) + static let width = UIScreen.main.bounds.width static let height: CGFloat = 64 } diff --git a/YouTube/Model/User.swift b/YouTube/Model/User.swift old mode 100644 new mode 100755 index d7defe9..8eec3fd --- a/YouTube/Model/User.swift +++ b/YouTube/Model/User.swift @@ -20,8 +20,8 @@ class User { //MARK: Methods class func fetchProfile(link: URL, completition: ((User) -> Void)) { - UIApplication.shared().isNetworkActivityIndicatorVisible = true - let _ = URLSession.shared().dataTask(with: link) { (data, response, error) in + UIApplication.shared.isNetworkActivityIndicatorVisible = true + let _ = URLSession.shared.dataTask(with: link) { (data, response, error) in if error == nil { do { let json = try JSONSerialization.jsonObject(with: data!, options: .mutableContainers) as! [String : AnyObject] @@ -41,11 +41,11 @@ class User { let user = User.init(name: name, profilePic: profilePic, backgroundImage: backgroundImage, playlists: playlists) completition(user) } catch _ { - let vc = UIApplication.shared().windows[0].rootViewController! + let vc = UIApplication.shared.windows[0].rootViewController! vc.showNotification() } } else { - let vc = UIApplication.shared().windows[0].rootViewController! + let vc = UIApplication.shared.windows[0].rootViewController! vc.showNotification() } }.resume() diff --git a/YouTube/Model/Video.swift b/YouTube/Model/Video.swift old mode 100644 new mode 100755 index a0bb5f5..f25c33d --- a/YouTube/Model/Video.swift +++ b/YouTube/Model/Video.swift @@ -37,7 +37,7 @@ class Video { //MARK: Methods class func download(link: URL, completiotion: ((Video) -> Void)) { - URLSession.shared().dataTask(with: link) { (data, _, error) in + URLSession.shared.dataTask(with: link) { (data, _, error) in if error == nil { do { let json = try JSONSerialization.jsonObject(with: data!, options: .mutableContainers) as! [String : AnyObject] @@ -69,7 +69,7 @@ class Video { suggestedVideos: suggestedVideos) completiotion(video) } catch _ { - let vc = UIApplication.shared().windows[0].rootViewController! + let vc = UIApplication.shared.windows[0].rootViewController! vc.showNotification() } } diff --git a/YouTube/Model/VideoItem.swift b/YouTube/Model/VideoItem.swift old mode 100644 new mode 100755 index f507ebc..5462bc8 --- a/YouTube/Model/VideoItem.swift +++ b/YouTube/Model/VideoItem.swift @@ -21,18 +21,18 @@ class VideoItem { //MARK: Download the list of items class func getVideosList(fromURL: URL, completition: ([[String : AnyObject]]) -> (Void)) { - UIApplication.shared().isNetworkActivityIndicatorVisible = true + UIApplication.shared.isNetworkActivityIndicatorVisible = true var items = [[String : AnyObject]]() - URLSession.shared().dataTask(with: fromURL) { (data, response, error) in + URLSession.shared.dataTask(with: fromURL) { (data, response, error) in if error != nil { - let vc = UIApplication.shared().windows[0].rootViewController! + let vc = UIApplication.shared.windows[0].rootViewController! vc.showNotification() } else{ do{ let json = try JSONSerialization.jsonObject(with: data!, options: .mutableContainers) items = json as! [[String : AnyObject]] } catch _ { - let vc = UIApplication.shared().windows[0].rootViewController! + let vc = UIApplication.shared.windows[0].rootViewController! vc.showNotification() } completition(items) @@ -42,8 +42,8 @@ class VideoItem { //MARK: single item download class func object(at: Int, fromList: Array<[String : AnyObject]>, completiotion: ((VideoItem, Int) -> Void)) { - UIApplication.shared().isNetworkActivityIndicatorVisible = true - DispatchQueue.global(attributes: DispatchQueue.GlobalAttributes.qosUserInteractive).async(execute: { + UIApplication.shared.isNetworkActivityIndicatorVisible = true + DispatchQueue.global(qos: .userInteractive).async(execute: { let item = fromList[at] let title = item["title"] as! String let tumbnail = UIImage.contentOfURL(link: item["thumbnail_image_name"] as! String) diff --git a/YouTube/Supporting views/CustomCollectionViewCell.swift b/YouTube/Supporting views/CustomCollectionViewCell.swift old mode 100644 new mode 100755 index a67d9a6..81fb021 --- a/YouTube/Supporting views/CustomCollectionViewCell.swift +++ b/YouTube/Supporting views/CustomCollectionViewCell.swift @@ -23,9 +23,9 @@ import UIKit func customization() { self.channelPic.layer.cornerRadius = 24 self.channelPic.clipsToBounds = true - self.videoDuration.backgroundColor = UIColor.black().withAlphaComponent(0.5) + self.videoDuration.backgroundColor = UIColor.black.withAlphaComponent(0.5) self.videoDuration.layer.borderWidth = 0.5 - self.videoDuration.layer.borderColor = UIColor.white().cgColor + self.videoDuration.layer.borderColor = UIColor.white.cgColor self.videoDuration.sizeToFit() } diff --git a/YouTube/Supporting views/FeedVC.swift b/YouTube/Supporting views/FeedVC.swift old mode 100644 new mode 100755 index 71ba58c..03d0dab --- a/YouTube/Supporting views/FeedVC.swift +++ b/YouTube/Supporting views/FeedVC.swift @@ -44,7 +44,7 @@ class FeedCollectionViewController: UICollectionViewController, UICollectionView self.itemsList += items DispatchQueue.main.async(execute: { self.collectionView?.reloadData() - UIApplication.shared().isNetworkActivityIndicatorVisible = false + UIApplication.shared.isNetworkActivityIndicatorVisible = false self.refresh.endRefreshing() }) } @@ -72,7 +72,7 @@ class FeedCollectionViewController: UICollectionViewController, UICollectionView self.videoItems[index] = video DispatchQueue.main.async(execute: { self.collectionView?.reloadData() - UIApplication.shared().isNetworkActivityIndicatorVisible = false + UIApplication.shared.isNetworkActivityIndicatorVisible = false }) }) } @@ -81,7 +81,7 @@ class FeedCollectionViewController: UICollectionViewController, UICollectionView // MARK: UICollectionViewDelegate func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { - let size = CGSize.init(width: UIScreen.main().bounds.width, height: 300) + let size = CGSize.init(width: UIScreen.main.bounds.width, height: 300) return size } @@ -97,14 +97,14 @@ class FeedCollectionViewController: UICollectionViewController, UICollectionView } override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { - NotificationCenter.default().post(name: "open" as NSNotification.Name, object: nil) + NotificationCenter.default.post(name: "open" as NSNotification.Name, object: nil) } override func scrollViewDidScroll(_ scrollView: UIScrollView) { if (self.lastContentOffset > scrollView.contentOffset.y) { - NotificationCenter.default().post(name: "hide" as NSNotification.Name, object: false) + NotificationCenter.default.post(name: "hide" as NSNotification.Name, object: false) } else { - NotificationCenter.default().post(name: "hide" as NSNotification.Name, object: true) + NotificationCenter.default.post(name: "hide" as NSNotification.Name, object: true) } } diff --git a/YouTube/Supporting views/Search.swift b/YouTube/Supporting views/Search.swift old mode 100644 new mode 100755 index 6b16353..6baaceb --- a/YouTube/Supporting views/Search.swift +++ b/YouTube/Supporting views/Search.swift @@ -16,21 +16,21 @@ class Search: UIView, UITableViewDelegate, UITableViewDataSource, UITextFieldDel //MARK: Properties let statusView: UIView = { - let st = UIView.init(frame: UIApplication.shared().statusBarFrame) - st.backgroundColor = UIColor.black() + let st = UIView.init(frame: UIApplication.shared.statusBarFrame) + st.backgroundColor = UIColor.black st.alpha = 0.15 return st }() lazy var searchView: UIView = { let sv = UIView.init(frame: CGRect.init(x: 0, y: 0, width: self.frame.width, height: 68)) - sv.backgroundColor = UIColor.white() + sv.backgroundColor = UIColor.white sv.alpha = 0 return sv }() lazy var backgroundView: UIView = { let bv = UIView.init(frame: self.frame) - bv.backgroundColor = UIColor.black() + bv.backgroundColor = UIColor.black bv.alpha = 0 return bv }() @@ -65,7 +65,7 @@ class Search: UIView, UITableViewDelegate, UITableViewDataSource, UITextFieldDel self.tableView.delegate = self self.tableView.dataSource = self self.tableView.tableFooterView = UIView() - self.tableView.backgroundColor = UIColor.clear() + self.tableView.backgroundColor = UIColor.clear self.searchField.delegate = self self.addSubview(self.statusView) } @@ -97,7 +97,7 @@ class Search: UIView, UITableViewDelegate, UITableViewDataSource, UITextFieldDel self.items = [] self.tableView.removeFromSuperview() } else{ - let _ = URLSession.shared().dataTask(with: requestSuggestionsURL(text: self.searchField.text!), completionHandler: { (data, response, error) in + let _ = URLSession.shared.dataTask(with: requestSuggestionsURL(text: self.searchField.text!), completionHandler: { (data, response, error) in if error == nil { do { let json = try JSONSerialization.jsonObject(with: data!, options: .mutableContainers) as! NSArray @@ -166,7 +166,7 @@ class searchCell: UITableViewCell { lazy var itemLabel: UILabel = { let il: UILabel = UILabel.init(frame: CGRect.init(x: 48, y: 0, width: self.contentView.bounds.width - 48, height: self.contentView.bounds.height)) - il.textColor = UIColor.gray() + il.textColor = UIColor.gray return il }() diff --git a/YouTube/Supporting views/SettingsTable.swift b/YouTube/Supporting views/SettingsTable.swift old mode 100644 new mode 100755 index 51be7e2..0c100ab --- a/YouTube/Supporting views/SettingsTable.swift +++ b/YouTube/Supporting views/SettingsTable.swift @@ -25,7 +25,7 @@ class Settings: UIView, UITableViewDelegate, UITableViewDataSource { lazy var backgroundView: UIView = { let bv = UIView.init(frame: self.frame) - bv.backgroundColor = UIColor.black() + bv.backgroundColor = UIColor.black bv.alpha = 0 return bv }() diff --git a/YouTube/Supporting views/SubscriptionsProfilePicCell.swift b/YouTube/Supporting views/SubscriptionsProfilePicCell.swift old mode 100644 new mode 100755 index 2a696af..64cdcdf --- a/YouTube/Supporting views/SubscriptionsProfilePicCell.swift +++ b/YouTube/Supporting views/SubscriptionsProfilePicCell.swift @@ -16,7 +16,7 @@ class SubscriptionsProfilePicCell: UICollectionViewCell, UICollectionViewDelegat //MARK: Methods func fetchImages() { - let _ = URLSession.shared().dataTask(with: globalVariables.subscriptionsLink) { (data, response, error) in + let _ = URLSession.shared.dataTask(with: globalVariables.subscriptionsLink) { (data, response, error) in if error != nil { print("Please check your internet connection") } else{ @@ -77,7 +77,7 @@ class ProfilePic: UICollectionViewCell { let pv = UIImageView.init(frame: CGRect.init(x: 10, y: 10, width: 50, height: 50)) pv.layer.cornerRadius = 25 pv.clipsToBounds = true - pv.backgroundColor = UIColor.gray() + pv.backgroundColor = UIColor.gray return pv }() diff --git a/YouTube/Supporting views/TabBar.swift b/YouTube/Supporting views/TabBar.swift old mode 100644 new mode 100755 index b80372b..2e708d8 --- a/YouTube/Supporting views/TabBar.swift +++ b/YouTube/Supporting views/TabBar.swift @@ -28,7 +28,7 @@ class TabBar: UIView, UICollectionViewDataSource, UICollectionViewDelegate, UICo let cv = UICollectionView.init(frame: CGRect.init(x: 0, y: 20, width: self.frame.width, height: (self.frame.height - 20)), collectionViewLayout: layout) cv.delegate = self cv.dataSource = self - cv.backgroundColor = UIColor.clear() + cv.backgroundColor = UIColor.clear cv.isScrollEnabled = false return cv }() @@ -93,7 +93,7 @@ class TabBarCellCollectionViewCell: UICollectionViewCell { override init(frame: CGRect) { super.init(frame: frame) - self.backgroundColor = UIColor.clear() + self.backgroundColor = UIColor.clear let width = (self.contentView.bounds.width - 30) / 2 icon.frame = CGRect.init(x: width, y: 2, width: 30, height: 30) let image = UIImage.init(named: "home") diff --git a/YouTube/ViewControllers/AccountVC.swift b/YouTube/ViewControllers/AccountVC.swift old mode 100644 new mode 100755 index 6afa3b0..69a1b51 --- a/YouTube/ViewControllers/AccountVC.swift +++ b/YouTube/ViewControllers/AccountVC.swift @@ -22,7 +22,7 @@ class AccountCollectionViewController: UICollectionViewController, UICollectionV self.user = newUser self.items = newUser.playlists.count + 5 DispatchQueue.main.async(execute: { - UIApplication.shared().isNetworkActivityIndicatorVisible = false + UIApplication.shared.isNetworkActivityIndicatorVisible = false self.collectionView?.reloadData() }) } diff --git a/YouTube/ViewControllers/MainViewController.swift b/YouTube/ViewControllers/MainViewController.swift old mode 100644 new mode 100755 index 0c57ab9..88ee0ef --- a/YouTube/ViewControllers/MainViewController.swift +++ b/YouTube/ViewControllers/MainViewController.swift @@ -20,11 +20,11 @@ class MainViewController: UIViewController, UICollectionViewDataSource, UICollec layout.scrollDirection = .horizontal layout.minimumInteritemSpacing = 0 layout.minimumLineSpacing = 0 - let cv: UICollectionView = UICollectionView.init(frame: CGRect.init(x: 0, y: 0, width: UIScreen.main().bounds.width, height: (self.view.bounds.height)), collectionViewLayout: layout) + let cv: UICollectionView = UICollectionView.init(frame: CGRect.init(x: 0, y: 0, width: UIScreen.main.bounds.width, height: (self.view.bounds.height)), collectionViewLayout: layout) cv.delegate = self cv.dataSource = self cv.showsHorizontalScrollIndicator = false - cv.backgroundColor = UIColor.clear() + cv.backgroundColor = UIColor.clear cv.bounces = false cv.isPagingEnabled = true cv.isDirectionalLockEnabled = true @@ -38,13 +38,13 @@ class MainViewController: UIViewController, UICollectionViewDataSource, UICollec }() lazy var settings: Settings = { - let st = Settings.init(frame: UIScreen.main().bounds) + let st = Settings.init(frame: UIScreen.main.bounds) st.delegate = self return st }() lazy var search: Search = { - let se = Search.init(frame: UIScreen.main().bounds) + let se = Search.init(frame: UIScreen.main.bounds) se.delegate = self return se }() @@ -52,7 +52,7 @@ class MainViewController: UIViewController, UICollectionViewDataSource, UICollec let titleLabel: UILabel = { let tl = UILabel.init(frame: CGRect.init(x: 20, y: 5, width: 200, height: 30)) tl.font = UIFont.systemFont(ofSize: 18) - tl.textColor = UIColor.white() + tl.textColor = UIColor.white tl.text = "Home" return tl }() @@ -95,14 +95,14 @@ class MainViewController: UIViewController, UICollectionViewDataSource, UICollec //MARK: Search and Settings @IBAction func handleSearch(_ sender: AnyObject) { - if let window = UIApplication.shared().keyWindow { + if let window = UIApplication.shared.keyWindow { window.addSubview(self.search) self.search.animate() } } @IBAction func handleMore(_ sender: AnyObject) { - if let window = UIApplication.shared().keyWindow { + if let window = UIApplication.shared.keyWindow { window.addSubview(self.settings) self.settings.animate() } @@ -136,7 +136,7 @@ class MainViewController: UIViewController, UICollectionViewDataSource, UICollec super.viewDidLoad() customization() didSelectItem(atIndex: 0) - NotificationCenter.default().addObserver(self, selector: #selector(MainViewController.hideBar(notification:)), name: "hide", object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(MainViewController.hideBar(notification:)), name: "hide" as NSNotification.Name, object: nil) } //MARK: CollectionView DataSources diff --git a/YouTube/ViewControllers/NavVC.swift b/YouTube/ViewControllers/NavVC.swift old mode 100644 new mode 100755 index bac85b0..3303c22 --- a/YouTube/ViewControllers/NavVC.swift +++ b/YouTube/ViewControllers/NavVC.swift @@ -13,25 +13,25 @@ class NavVC: UINavigationController, PlayerVCDelegate { //MARK: Properties lazy var playVC: PlayVC = { let pvc: PlayVC = self.storyboard?.instantiateViewController(withIdentifier: "PlayVC") as! PlayVC - pvc.view.frame = CGRect.init(origin: self.hiddenOrigin, size: UIScreen.main().bounds.size) + pvc.view.frame = CGRect.init(origin: self.hiddenOrigin, size: UIScreen.main.bounds.size) pvc.delegate = self return pvc }() let statusView: UIView = { - let st = UIView.init(frame: UIApplication.shared().statusBarFrame) - st.backgroundColor = UIColor.black() + let st = UIView.init(frame: UIApplication.shared.statusBarFrame) + st.backgroundColor = UIColor.black st.alpha = 0.15 return st }() let hiddenOrigin: CGPoint = { - let y = UIScreen.main().bounds.height - (UIScreen.main().bounds.width * 9 / 32) - 10 - let x = -UIScreen.main().bounds.width + let y = UIScreen.main.bounds.height - (UIScreen.main.bounds.width * 9 / 32) - 10 + let x = -UIScreen.main.bounds.width let coordinate = CGPoint.init(x: x, y: y) return coordinate }() let minimizedOrigin: CGPoint = { - let x = UIScreen.main().bounds.width/2 - 10 - let y = UIScreen.main().bounds.height - (UIScreen.main().bounds.width * 9 / 32) - 10 + let x = UIScreen.main.bounds.width/2 - 10 + let y = UIScreen.main.bounds.height - (UIScreen.main.bounds.width * 9 / 32) - 10 let coordinate = CGPoint.init(x: x, y: y) return coordinate }() @@ -56,10 +56,10 @@ class NavVC: UINavigationController, PlayerVCDelegate { } func positionDuringSwipe(scaleFactor: CGFloat) -> CGPoint { - let width = UIScreen.main().bounds.width * 0.5 * scaleFactor + let width = UIScreen.main.bounds.width * 0.5 * scaleFactor let height = width * 9 / 16 - let x = (UIScreen.main().bounds.width - 10) * scaleFactor - width - let y = (UIScreen.main().bounds.height - 10) * scaleFactor - height + let x = (UIScreen.main.bounds.width - 10) * scaleFactor - width + let y = (UIScreen.main.bounds.height - 10) * scaleFactor - height let coordinate = CGPoint.init(x: x, y: y) return coordinate } @@ -82,7 +82,7 @@ class NavVC: UINavigationController, PlayerVCDelegate { case .fullScreen: self.playVC.view.frame.origin = self.positionDuringSwipe(scaleFactor: translation) case .hidden: - self.playVC.view.frame.origin.x = UIScreen.main().bounds.width/2 - abs(translation) - 10 + self.playVC.view.frame.origin.x = UIScreen.main.bounds.width/2 - abs(translation) - 10 case .minimized: self.playVC.view.frame.origin = self.positionDuringSwipe(scaleFactor: translation) } @@ -95,7 +95,7 @@ class NavVC: UINavigationController, PlayerVCDelegate { override func viewDidAppear(_ animated: Bool) { super.viewWillAppear(true) - if let window = UIApplication.shared().keyWindow { + if let window = UIApplication.shared.keyWindow { window.addSubview(self.statusView) window.addSubview(self.playVC.view) } diff --git a/YouTube/ViewControllers/PlayVC.swift b/YouTube/ViewControllers/PlayVC.swift old mode 100644 new mode 100755 index efad879..ba86a00 --- a/YouTube/ViewControllers/PlayVC.swift +++ b/YouTube/ViewControllers/PlayVC.swift @@ -29,11 +29,11 @@ class PlayVC: UIViewController, UITableViewDelegate, UITableViewDataSource, UIGe //MARK: Methods func customization() { - self.view.backgroundColor = UIColor.clear() - self.player.layer.anchorPoint.apply(transform: CGAffineTransform.init(translationX: -0.5, y: -0.5)) + self.view.backgroundColor = UIColor.clear + self.player.layer.anchorPoint.applying(CGAffineTransform.init(translationX: -0.5, y: -0.5)) self.tableView.tableFooterView = UIView.init(frame: CGRect.init(x: 0, y: 0, width: 0, height: 0)) self.player.addGestureRecognizer(UITapGestureRecognizer.init(target: self, action: #selector(PlayVC.tapPlayView))) - NotificationCenter.default().addObserver(self, selector: #selector(PlayVC.tapPlayView), name: "open", object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(PlayVC.tapPlayView), name: "open" as NSNotification.Name, object: nil) } func animate() { @@ -43,15 +43,15 @@ class PlayVC: UIViewController, UITableViewDelegate, UITableViewDataSource, UIGe self.minimizeButton.alpha = 1 self.tableView.alpha = 1 self.player.transform = CGAffineTransform.identity - UIApplication.shared().isStatusBarHidden = true + UIApplication.shared.isStatusBarHidden = true }) case .minimized: UIView.animate(withDuration: 0.3, animations: { - UIApplication.shared().isStatusBarHidden = false + UIApplication.shared.isStatusBarHidden = false self.minimizeButton.alpha = 0 self.tableView.alpha = 0 let scale = CGAffineTransform.init(scaleX: 0.5, y: 0.5) - let trasform = scale.concat(CGAffineTransform.init(translationX: -self.player.bounds.width/4, y: -self.player.bounds.height/4)) + let trasform = scale.concatenating(CGAffineTransform.init(translationX: -self.player.bounds.width/4, y: -self.player.bounds.height/4)) self.player.transform = trasform }) default: break @@ -62,7 +62,7 @@ class PlayVC: UIViewController, UITableViewDelegate, UITableViewDataSource, UIGe self.minimizeButton.alpha = 1 - scaleFactor self.tableView.alpha = 1 - scaleFactor let scale = CGAffineTransform.init(scaleX: (1 - 0.5 * scaleFactor), y: (1 - 0.5 * scaleFactor)) - let trasform = scale.concat(CGAffineTransform.init(translationX: -(self.player.bounds.width / 4 * scaleFactor), y: -(self.player.bounds.height / 4 * scaleFactor))) + let trasform = scale.concatenating(CGAffineTransform.init(translationX: -(self.player.bounds.width / 4 * scaleFactor), y: -(self.player.bounds.height / 4 * scaleFactor))) self.player.transform = trasform } @@ -91,7 +91,7 @@ class PlayVC: UIViewController, UITableViewDelegate, UITableViewDataSource, UIGe var finalState = stateOfVC.fullScreen switch self.state { case .fullScreen: - let factor = (abs(sender.translation(in: nil).y) / UIScreen.main().bounds.height) + let factor = (abs(sender.translation(in: nil).y) / UIScreen.main.bounds.height) self.changeValues(scaleFactor: factor) self.delegate?.swipeToMinimize(translation: factor, toState: .minimized) finalState = .minimized @@ -102,7 +102,7 @@ class PlayVC: UIViewController, UITableViewDelegate, UITableViewDataSource, UIGe self.delegate?.swipeToMinimize(translation: factor, toState: .hidden) } else { finalState = .fullScreen - let factor = 1 - (abs(sender.translation(in: nil).y) / UIScreen.main().bounds.height) + let factor = 1 - (abs(sender.translation(in: nil).y) / UIScreen.main.bounds.height) self.changeValues(scaleFactor: factor) self.delegate?.swipeToMinimize(translation: factor, toState: .fullScreen) } diff --git a/YouTube/ViewControllers/SubscriptionsVC.swift b/YouTube/ViewControllers/SubscriptionsVC.swift old mode 100644 new mode 100755 index b9caf53..4135fc0 --- a/YouTube/ViewControllers/SubscriptionsVC.swift +++ b/YouTube/ViewControllers/SubscriptionsVC.swift @@ -37,7 +37,7 @@ class SubscriptionsCollectionViewController: FeedCollectionViewController { self.videoItems[index] = video DispatchQueue.main.async(execute: { self.collectionView?.reloadData() - UIApplication.shared().isNetworkActivityIndicatorVisible = false + UIApplication.shared.isNetworkActivityIndicatorVisible = false }) }) } @@ -48,9 +48,9 @@ class SubscriptionsCollectionViewController: FeedCollectionViewController { // MARK: UICollectionViewDelegate override func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { - var size = CGSize.init(width: UIScreen.main().bounds.width, height: 300) + var size = CGSize.init(width: UIScreen.main.bounds.width, height: 300) if indexPath.row == 0 { - size = CGSize.init(width: UIScreen.main().bounds.width, height: 70) + size = CGSize.init(width: UIScreen.main.bounds.width, height: 70) } return size } diff --git a/YouTube/ViewControllers/TrendingVC.swift b/YouTube/ViewControllers/TrendingVC.swift old mode 100644 new mode 100755 index 8fcc14c..ff2edf0 --- a/YouTube/ViewControllers/TrendingVC.swift +++ b/YouTube/ViewControllers/TrendingVC.swift @@ -51,7 +51,7 @@ class TrendingCollectionViewController: FeedCollectionViewController { self.videoItems[index] = video DispatchQueue.main.async(execute: { self.collectionView?.reloadData() - UIApplication.shared().isNetworkActivityIndicatorVisible = false + UIApplication.shared.isNetworkActivityIndicatorVisible = false }) }) } @@ -64,9 +64,9 @@ class TrendingCollectionViewController: FeedCollectionViewController { override func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { var size = CGSize() if indexPath.row == 0 { - size = CGSize.init(width: UIScreen.main().bounds.width, height: 100) + size = CGSize.init(width: UIScreen.main.bounds.width, height: 100) } else { - size = CGSize.init(width: UIScreen.main().bounds.width, height: 300) + size = CGSize.init(width: UIScreen.main.bounds.width, height: 300) } return size }