Skip to content

Commit

Permalink
clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Barreto committed Jan 28, 2016
1 parent bcd395c commit 4b10bcf
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 31 deletions.
4 changes: 2 additions & 2 deletions Example/Example/BarExampleViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ class BarExampleViewController: BarPagerTabStripViewController {
override func childViewControllersForPagerTabStripViewController(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {

let child_1 = TableChildExampleViewController(style: .Plain, itemInfo: "Table View")
let child_2 = ChildExampleViewController(title: "View")
let child_2 = ChildExampleViewController(itemInfo: "View")
let child_3 = TableChildExampleViewController(style: .Grouped, itemInfo: "Table View 2")
let child_4 = ChildExampleViewController(title: "View 2")
let child_4 = ChildExampleViewController(itemInfo: "View 2")

guard isReload else {
return [child_1, child_2, child_3, child_4]
Expand Down
8 changes: 4 additions & 4 deletions Example/Example/ButtonBarExampleViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ class ButtonBarExampleViewController: ButtonBarPagerTabStripViewController {

override func childViewControllersForPagerTabStripViewController(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
let child_1 = TableChildExampleViewController(style: .Plain, itemInfo: "Table View")
let child_2 = ChildExampleViewController(title: "View")
let child_2 = ChildExampleViewController(itemInfo: "View")
let child_3 = TableChildExampleViewController(style: .Grouped, itemInfo: "Table View 2")
let child_4 = ChildExampleViewController(title: "View 2")
let child_4 = ChildExampleViewController(itemInfo: "View 2")
let child_5 = TableChildExampleViewController(style: .Plain, itemInfo: "Table View 3")
let child_6 = ChildExampleViewController(title: "View 3")
let child_6 = ChildExampleViewController(itemInfo: "View 3")
let child_7 = TableChildExampleViewController(style: .Grouped, itemInfo: "Table View 4")
let child_8 = ChildExampleViewController(title: "View 4")
let child_8 = ChildExampleViewController(itemInfo: "View 4")

guard isReload else {
return [child_1, child_2, child_3, child_4, child_5, child_6, child_7, child_8]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ import XLPagerTabStrip

class ChildExampleViewController: UIViewController, PagerTabStripChildItem {

var indicatorTitle = "View"
var itemInfo: ChildItemInfo = "View"

init(title: String) {
indicatorTitle = title
init(itemInfo: ChildItemInfo) {
self.itemInfo = itemInfo
super.init(nibName: nil, bundle: nil)
}

Expand All @@ -55,6 +55,6 @@ class ChildExampleViewController: UIViewController, PagerTabStripChildItem {
// MARK: - PagerTabStripChildItem

func childInfoForPagerTabStripViewController(pagerTabStripController: PagerTabStripViewController) -> ChildItemInfo {
return ChildItemInfo(title: indicatorTitle)
return itemInfo
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import XLPagerTabStrip
class TableChildExampleViewController: UITableViewController, PagerTabStripChildItem {

let cellIdentifier = "postCell"

var blackTheme = false
var itemInfo = ChildItemInfo(title: "View")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ class InstagramExampleViewController: ButtonBarPagerTabStripViewController {

override func childViewControllersForPagerTabStripViewController(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
let child_1 = TableChildExampleViewController(style: .Plain, itemInfo: "FOLLOWING")
let child_2 = ChildExampleViewController(title: "YOU")
let child_2 = ChildExampleViewController(itemInfo: "YOU")
return [child_1, child_2]
}

// MARK: - Custom Action

@IBAction func closeAction(sender: UIButton) {
dismissViewControllerAnimated(true, completion: nil)
Expand Down
8 changes: 4 additions & 4 deletions Example/Example/NavButtonBarExampleViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ class NavButtonBarExampleViewController: ButtonBarPagerTabStripViewController {

override func childViewControllersForPagerTabStripViewController(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
let child_1 = TableChildExampleViewController(style: .Plain, itemInfo: "Table View")
let child_2 = ChildExampleViewController(title: "View")
let child_2 = ChildExampleViewController(itemInfo: "View")
let child_3 = TableChildExampleViewController(style: .Grouped, itemInfo: "Table View 2")
let child_4 = ChildExampleViewController(title: "View 1")
let child_4 = ChildExampleViewController(itemInfo: "View 1")
let child_5 = TableChildExampleViewController(style: .Plain, itemInfo: "Table View 3")
let child_6 = ChildExampleViewController(title: "View 2")
let child_6 = ChildExampleViewController(itemInfo: "View 2")
let child_7 = TableChildExampleViewController(style: .Grouped, itemInfo: "Table View 4")
let child_8 = ChildExampleViewController(title: "View 3")
let child_8 = ChildExampleViewController(itemInfo: "View 3")

guard isReload else {
return [child_1, child_2, child_3, child_4, child_5, child_6, child_7, child_8]
Expand Down
4 changes: 2 additions & 2 deletions Example/Example/SegmentedExampleViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ class SegmentedExampleViewController: SegmentedPagerTabStripViewController {

override func childViewControllersForPagerTabStripViewController(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
let child_1 = TableChildExampleViewController(style: .Plain, itemInfo: "Table View")
let child_2 = ChildExampleViewController(title: "View")
let child_2 = ChildExampleViewController(itemInfo: "View")
let child_3 = TableChildExampleViewController(style: .Grouped, itemInfo: "Table View 2")
let child_4 = ChildExampleViewController(title: "View 2")
let child_4 = ChildExampleViewController(itemInfo: "View 2")

guard isReload else {
return [child_1, child_2, child_3, child_4]
Expand Down
2 changes: 2 additions & 0 deletions Example/Example/Spotify/SpotifyExampleViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ public class SpotifyExampleViewController: ButtonBarPagerTabStripViewController
return [child_1, child_2]
}

// MARK: - Actions

@IBAction func closeAction(sender: UIButton) {
dismissViewControllerAnimated(true, completion: nil)
}
Expand Down
8 changes: 4 additions & 4 deletions Example/Example/TwitterExampleViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ class TwitterExampleViewController: TwitterPagerTabStripViewController {
override func childViewControllersForPagerTabStripViewController(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {

let child_1 = TableChildExampleViewController(style: .Plain, itemInfo: "TableView")
let child_2 = ChildExampleViewController(title: "View")
let child_2 = ChildExampleViewController(itemInfo: "View")
let child_3 = TableChildExampleViewController(style: .Grouped, itemInfo: "TableView 2")
let child_4 = ChildExampleViewController(title: "View 2")
let child_4 = ChildExampleViewController(itemInfo: "View 2")
let child_5 = TableChildExampleViewController(style: .Plain, itemInfo: "TableView 3")
let child_6 = ChildExampleViewController(title: "View 3")
let child_6 = ChildExampleViewController(itemInfo: "View 3")
let child_7 = TableChildExampleViewController(style: .Grouped, itemInfo: "TableView 4")
let child_8 = ChildExampleViewController(title: "View 4")
let child_8 = ChildExampleViewController(itemInfo: "View 4")

guard isReload else {
return [child_1, child_2, child_3, child_4, child_5, child_6, child_7, child_8]
Expand Down
9 changes: 4 additions & 5 deletions Example/Example/Youtube/YoutubeExampleViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ import XLPagerTabStrip

class YoutubeExampleViewController: BaseButtonBarPagerTabStripViewController<YoutubeIconCell> {

let homeImage = UIImage(named: "home")
let trendingImage = UIImage(named: "trending")
let profileImage = UIImage(named: "profile")
let redColor = UIColor(red: 221/255.0, green: 0/255.0, blue: 19/255.0, alpha: 1.0)
let unselectedIconColor = UIColor(red: 73/255.0, green: 8/255.0, blue: 10/255.0, alpha: 1.0)

Expand Down Expand Up @@ -74,8 +71,8 @@ class YoutubeExampleViewController: BaseButtonBarPagerTabStripViewController<You

override func childViewControllersForPagerTabStripViewController(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
let child_1 = TableChildExampleViewController(style: .Plain, itemInfo: ChildItemInfo(title: "HOME", image: UIImage(named: "home")))
let child_2 = TableChildExampleViewController(style: .Grouped, itemInfo: ChildItemInfo(title: "TRENDING", image: UIImage(named: "trending")))
let child_3 = TableChildExampleViewController(style: .Plain, itemInfo: ChildItemInfo(title: "PROFILE", image: UIImage(named: "profile")))
let child_2 = TableChildExampleViewController(style: .Plain, itemInfo: ChildItemInfo(title: "TRENDING", image: UIImage(named: "trending")))
let child_3 = TableChildExampleViewController(style: .Grouped, itemInfo: ChildItemInfo(title: "PROFILE", image: UIImage(named: "profile")))
return [child_1, child_2, child_3]
}

Expand All @@ -95,6 +92,8 @@ class YoutubeExampleViewController: BaseButtonBarPagerTabStripViewController<You
})
}
}

// MARK: - Actions

@IBAction func closeAction(sender: UIButton) {
dismissViewControllerAnimated(true, completion: nil)
Expand Down
22 changes: 19 additions & 3 deletions Example/Example/Youtube/YoutubeIconCell.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
//
// YoutubeIconCell.swift
// Example
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2016 Xmartlabs ( http://xmartlabs.com )
//
//
// Created by Martin Barreto on 1/28/16.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

import Foundation
import UIKit
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ That's it! We're done! 🍻🍻
* If you **have a feature request** please **open an issue**.
* If you **found a bug** or **need help** please **check older issues, [FAQ](#faq) and threads on [StackOverflow](http://stackoverflow.com/questions/tagged/XLPagerTabStrip) (Tag 'XLPagerTabStrip') before submitting an issue**.

Before contribute check the [CONTRIBUTING](https://github.com/xmartlabs/XLPagerTabStrip/blob/master/CONTRIBUTING.md) file for more info.
Before contribute check the [CONTRIBUTING](CONTRIBUTING.md) file for more info.

If you use **XLPagerTabStrip** in your app We would love to hear about it! Drop us a line on [twitter](https://twitter.com/xmartlabs).

Expand Down

0 comments on commit 4b10bcf

Please sign in to comment.