Skip to content

Commit 959e589

Browse files
author
M"e
authored
Merge pull request #66 from hiragram/master
Changing `tabItemsCount` from stored property to computed property
2 parents d244b43 + b5f4716 commit 959e589

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

Sources/TabPageViewController.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@ import UIKit
1111
open class TabPageViewController: UIPageViewController {
1212
open var isInfinity: Bool = false
1313
open var option: TabPageOption = TabPageOption()
14-
open var tabItems: [(viewController: UIViewController, title: String)] = [] {
15-
didSet {
16-
tabItemsCount = tabItems.count
17-
}
18-
}
14+
open var tabItems: [(viewController: UIViewController, title: String)] = []
1915

2016
var currentIndex: Int? {
2117
guard let viewController = viewControllers?.first else {
@@ -24,7 +20,9 @@ open class TabPageViewController: UIPageViewController {
2420
return tabItems.map{ $0.viewController }.index(of: viewController)
2521
}
2622
fileprivate var beforeIndex: Int = 0
27-
fileprivate var tabItemsCount = 0
23+
fileprivate var tabItemsCount: Int {
24+
return tabItems.count
25+
}
2826
fileprivate var defaultContentOffsetX: CGFloat {
2927
return self.view.bounds.width
3028
}

0 commit comments

Comments
 (0)