Skip to content

Commit

Permalink
Merge branch 'release/0.4.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
msaps committed Mar 30, 2017
2 parents aebab77 + 8217668 commit c818648
Show file tree
Hide file tree
Showing 13 changed files with 78 additions and 15 deletions.
34 changes: 34 additions & 0 deletions Docs/APPEARANCE_DEFAULTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Appearance Defaults

A number of appearance properties are set on `TabmanBar` by default. These can all be overriden.

| Property | Type | Value |
|---------------|:-----:|-----|
| `.indicator.bounces` | `Bool` | `false` |
| `.indicator.compresses` | `Bool` | `false` |
| `.indicator.isProgressive` | `Bool` | `false` |
| `.indicator.useRoundedCorners` | `Bool` | `false` |
| `.indicator.lineWeight` | `LineWeight` | `.normal` |
| `.indicator.color` | `UIColor` | `defaultTintColor` |
|
| `.state.selectedColor` | `UIColor` | `.black` |
| `.state.color` | `UIColor` | `.black.withAlphaComponent(0.5)` |
|
| `.text.font` | `UIFont` | `UIFont.systemFont(ofSize: 16.0)` |
|
| `.layout.height` | `Height` | `.auto` |
| `.layout.interItemSpacing` | `CGFloat` | `20.0` |
| `.layout.edgeInset` | `CGFloat` | `16.0` |
| `.layout.itemVerticalPadding` | `CGFloat` | `12.0` |
|
| `.style.background` | `BackgroundStyle` | `.blur(style: .extraLight)` |
| `.style.bottomSeparatorColor` | `UIColor` | `.clear` |
|
| `.interaction.isScrollEnabled` | `Bool` | `true` |







2 changes: 1 addition & 1 deletion Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ workspace 'Tabman'
use_frameworks!

def shared_pods
pod 'Pageboy', '~> 0.4.0'
pod 'Pageboy', '~> 1.0.0'
pod 'PureLayout', '~> 3.0.0'
end

Expand Down
8 changes: 4 additions & 4 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
PODS:
- Pageboy (0.4.12)
- Pageboy (1.0.0)
- PureLayout (3.0.2)

DEPENDENCIES:
- Pageboy (~> 0.4.0)
- Pageboy (~> 1.0.0)
- PureLayout (~> 3.0.0)

SPEC CHECKSUMS:
Pageboy: 4a0a478d78cf5b31a5439828bc8f6519edf4e508
Pageboy: 7efa3ef59ca0601aae7f26980530153f8151704e
PureLayout: 4d550abe49a94f24c2808b9b95db9131685fe4cd

PODFILE CHECKSUM: 994920f5c7f362a30b31a8faaa230fa3db37e92c
PODFILE CHECKSUM: fd0820ca8c653c9e1ceb3900d55462536ff3ac55

COCOAPODS: 1.2.0
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ public struct Interaction {
}
```

##### Defaults
A number of default properties are set on `TabmanBar.Appearance`, these can be viewed [here](Docs/APPEARANCE_DEFAULTS.md).

### Advanced

For more advanced customisation, including defining your own indicator and bar styles please read [here](Docs/ADVANCED_CUSTOMISATION.md).
Expand Down
2 changes: 1 addition & 1 deletion Sources/Tabman/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.4.2</string>
<string>0.4.3</string>
<key>CFBundleVersion</key>
<string>AUTO_GENERATED</string>
<key>NSPrincipalClass</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,9 @@ internal class TabmanButtonBar: TabmanBar {
} else if let image = item.image {
// resize images to fit
let resizedImage = image.resize(toSize: Defaults.itemImageSize)
button.setImage(resizedImage.withRenderingMode(.alwaysTemplate), for: .normal)
if resizedImage.size != .zero {
button.setImage(resizedImage.withRenderingMode(.alwaysTemplate), for: .normal)
}
}

// appearance
Expand Down
2 changes: 1 addition & 1 deletion Sources/Tabman/TabmanBar/TabmanBar+Appearance.swift
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public extension TabmanBar {
self.style.bottomSeparatorColor = .clear

// interaction
self.interaction.isScrollEnabled = false
self.interaction.isScrollEnabled = true
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/Tabman/TabmanBar/TabmanBar+Protocols.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Foundation
import Pageboy

public protocol TabmanBarDataSource {
public protocol TabmanBarDataSource: class {

/// The items to display in a bar.
///
Expand All @@ -18,7 +18,7 @@ public protocol TabmanBarDataSource {
func items(forBar bar: TabmanBar) -> [TabmanBarItem]?
}

internal protocol TabmanBarDelegate {
internal protocol TabmanBarDelegate: class {

/// The bar did select an item at an index.
///
Expand Down
4 changes: 2 additions & 2 deletions Sources/Tabman/TabmanBar/TabmanBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ open class TabmanBar: UIView, TabmanBarLifecycle {
internal weak var transitionStore: TabmanBarTransitionStore?

/// The object that acts as a delegate to the bar.
internal var delegate: TabmanBarDelegate?
internal weak var delegate: TabmanBarDelegate?
/// The object that acts as a data source to the bar.
public var dataSource: TabmanBarDataSource? {
public weak var dataSource: TabmanBarDataSource? {
didSet {
self.reloadData()
}
Expand Down
5 changes: 5 additions & 0 deletions Sources/Tabman/TabmanViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ internal extension TabmanViewController {
location = self.bar.style.preferredLocation
}

// ensure bar is always on top
// Having to use CGFloat cast due to CGFloat.greatestFiniteMagnitude causing
// "zPosition should be within (-FLT_MAX, FLT_MAX) range" error.
bar.layer.zPosition = CGFloat(Float.greatestFiniteMagnitude)

bar.removeFromSuperview()
self.view.addSubview(bar)

Expand Down
8 changes: 6 additions & 2 deletions Sources/TabmanTests/TabmanBarAppearanceTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@ class TabmanBarAppearanceTests: TabmanViewControllerTests {
appearance.indicator.preferredStyle = .dot
})

self.tabmanViewController.bar.appearance = TabmanBar.Appearance({ (appearance) in
appearance.indicator.preferredStyle = .chevron
})

let indicator = self.tabmanViewController.tabmanBar!.indicator!
let type = TabmanIndicator.Style.dot.rawType!
let type = TabmanIndicator.Style.chevron.rawType!

XCTAssertTrue(type(of: indicator) == type,
"preferredIndicatorStyle is incorrectly ignored to when using .buttonBar style")
"preferredIndicatorStyle is incorrectly ignored when using .buttonBar style")
}

func testPreferredIndicatorStyleIgnorance() {
Expand Down
15 changes: 15 additions & 0 deletions Sources/TabmanTests/TabmanBarConfigTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,19 @@ class TabmanBarConfigTests: TabmanViewControllerTests {
XCTAssert(self.tabmanViewController.bar.appearance?.state.color == textColor,
"TabmanBarConfig does not update bar appearance correctly.")
}

/// Test that the TabmanBarConfig allows image items to be set correctly.
func testBarConfigImageItemsTest() {

let barItemCount = self.tabmanViewController.bar.items?.count ?? 0

var barItems = [TabmanBarItem]()
for _ in 0 ..< barItemCount {
barItems.append(TabmanBarItem(image: UIImage()))
}
self.tabmanViewController.bar.items = barItems

XCTAssertEqual(barItemCount, self.tabmanViewController.bar.items!.count,
"TabmanBarConfig does not support TabmanBarItem with images correctly.")
}
}
2 changes: 1 addition & 1 deletion Tabman.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Pod::Spec.new do |s|
s.platform = :ios, "9.0"
s.requires_arc = true

s.version = "0.4.2"
s.version = "0.4.3"
s.summary = "A powerful paging view controller with indicator bar for iOS"
s.description = <<-DESC
Tabman is a highly customisable, powerful and extendable paging view controller with indicator bar.
Expand Down

0 comments on commit c818648

Please sign in to comment.