Forráskód Böngészése

MediaViewController: MediaDataSource: Remove unnecessary init

Soomin Lee 7 éve
szülő
commit
7e1b17fbe2

+ 3 - 3
SharedSources/MediaDataSource.swift

@@ -14,12 +14,12 @@
 public class MediaDataSourceAndDelegate: NSObject, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
 
     private let cellPadding: CGFloat = 5.0
-    private var services: Services!
+    private var services: Services
     public weak var delegate: UICollectionViewDelegate?
 
-    public convenience init(services: Services) {
-        self.init()
+    init(services: Services) {
         self.services = services
+        super.init()
     }
 
     public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {

+ 3 - 7
Sources/MediaViewController.swift

@@ -19,7 +19,7 @@ import Foundation
 }
 
 public class VLCMediaViewController: UICollectionViewController, UISearchResultsUpdating, UISearchControllerDelegate {
-    private var services: Services!
+    private var services: Services
     private var mediaDatasourceAndDelegate: MediaDataSourceAndDelegate?
     private var searchController: UISearchController?
     private let searchDataSource = VLCLibrarySearchDisplayDataSource()
@@ -40,16 +40,12 @@ public class VLCMediaViewController: UICollectionViewController, UISearchResults
         return emptyView
     }()
 
-    public convenience init(services: Services) {
-        self.init(collectionViewLayout: UICollectionViewFlowLayout())
+    init(services: Services) {
         self.services = services
+        super.init(collectionViewLayout: UICollectionViewFlowLayout())
         NotificationCenter.default.addObserver(self, selector: #selector(themeDidChange), name: .VLCThemeDidChangeNotification, object: nil)
     }
 
-    public override init(collectionViewLayout layout: UICollectionViewLayout) {
-        super.init(collectionViewLayout: layout)
-    }
-
     @available(*, unavailable)
     required public init?(coder aDecoder: NSCoder) {
         fatalError("init(coder:) has not been implemented")

+ 2 - 2
Sources/VLCTabBarCoordinator.swift

@@ -16,13 +16,13 @@ class VLCTabbarCooordinator: NSObject, VLCMediaViewControllerDelegate {
 
     private var childCoordinators: [NSObject] = []
     private var tabBarController: UITabBarController
-    private var services: Services!
+    private var services: Services
     private let displayController = VLCPlayerDisplayController()
 
     public init(tabBarController: UITabBarController, services: Services) {
         self.tabBarController = tabBarController
-        super.init()
         self.services = services
+        super.init()
         NotificationCenter.default.addObserver(self, selector: #selector(updateTheme), name: .VLCThemeDidChangeNotification, object: nil)
     }