Skip to content

Commit

Permalink
Merge branch 'release/0.5.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
msaps committed May 24, 2017
2 parents 4faf7f1 + 9f90d53 commit 375e2ae
Show file tree
Hide file tree
Showing 26 changed files with 369 additions and 227 deletions.
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@ script:
after_success:
- bash <(curl -s https://codecov.io/bash)
notifications:
email: false
email: false
branches:
only:
- master
- develop
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github "PureLayout/PureLayout" "v3.0.2"
github "uias/Pageboy" "1.0.7"
github "uias/Pageboy" "1.0.8"
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github "PureLayout/PureLayout" "v3.0.2"
github "uias/Pageboy" "1.0.5"
github "uias/Pageboy" "1.0.8"
97 changes: 97 additions & 0 deletions Docs/APPEARANCE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Appearance

There are extensive options available in Tabman to customise the component to your liking. These are divided into appropriate functional structures:

- **[Indicator](#indicator)**
- **[Interaction](#interaction)**
- **[Layout](#layout)**
- **[State](#state)**
- **[Style](#style)**
- **[Text](#text)**

## Indicator
Customise how the indicator looks and behaves.

```swift
bar.appearance.indicator
```

| Property | Type | Description | Default |
|----------|------|-------------|---------|
| `preferredStyle` | `TabmanIndicator.Style` | The preferred style to use for the indicator (optionally conformed to by the bar). | `nil` |
| `color` | `UIColor` | The color of the bar indicator. | `tintColor` |
| `lineWeight` | `TabmanIndicator.LineWeight` | The weight (thickness) of the bar indicator if using a line indicator. | `.normal` |
| `isProgressive` | `Bool` | Whether the indicator transiton is progressive. | `false` |
| `bounces` | `Bool` | Whether the indicator bounces at the end of page ranges. | `false` |
| `compresses` | `Bool` | Whether the indicator compresses at the end of page ranges (Unavailable if bounces enabled). | `false` |
| `useRoundedCorners` | `Bool` | Whether to use rounded corners on line indicators. | `false` |


## Interaction
Customise how the bar can be interacted with.

```swift
bar.appearance.interaction
```

| Property | Type | Description | Default |
|----------|------|-------------|---------|
| `isScrollEnabled` | `Bool` | Whether user scroll is enabled on a scrolling button bar. | `true` |


## Layout
Customise how the bar lays itself and its items out.

```swift
bar.appearance.layout
```

| Property | Type | Description | Default |
|----------|------|-------------|---------|
| `interItemSpacing` | `CGFloat` | The spacing between items in the bar. | `20.0` |
| `edgeInset` | `CGFloat` | The spacing at the edge of the items in the bar. | `16.0` |
| `height` | `TabmanBar.Height` | The height for the bar. | `.auto` |
| `itemVerticalPadding` | `CGFloat` | The vertical padding between the item and the bar bounds. | `12.0` |
| `itemDistribution` | `ItemDistribution` | How items in the bar should be distributed. | `.leftAligned` |


## State
Customise how the bar should react to state changes.

```swift
bar.appearance.state
```

| Property | Type | Description | Default |
|----------|------|-------------|---------|
| `selectedColor` | `UIColor` | The color to use for selected items in the bar (text/images etc.). | `.black` |
| `color` | `UIColor` | The text color to use for unselected items in the bar (text/images etc.). | `.black.withAlphaComponent(0.5)` |


## Style
Customise any stylistic appearance properties of the bar.

```swift
bar.appearance.style
```

| Property | Type | Description | Default |
|----------|------|-------------|---------|
| `background` | `TabmanBarBackgroundView.BackgroundStyle` | The background style for the bar. | `.blur(style: .extraLight)` |
| `showEdgeFade` | `Bool` | Whether to show a fade on the items at the bounds edge of a scrolling button bar. | `false` |
| `bottomSeparatorColor` | `UIColor` | Color of the separator at the bottom of the bar. | `.clear` |


## Text
Customise any text displayed in a bar.

```swift
bar.appearance.text
```

| Property | Type | Description | Default |
|----------|------|-------------|---------|
| `font` | `UIFont` | The font to use for text labels in the bar. | `.systemFont(ofSize: 16.0)` |



29 changes: 0 additions & 29 deletions Docs/APPEARANCE_DEFAULTS.md

This file was deleted.

30 changes: 19 additions & 11 deletions Example/Tabman-Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
D62AC1091E5736A10020B8AE /* ChildViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D62AC1041E5736A10020B8AE /* ChildViewController.swift */; };
D62AC10A1E5736A10020B8AE /* GradientView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D62AC1051E5736A10020B8AE /* GradientView.swift */; };
D62AC10B1E5736A10020B8AE /* TabViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D62AC1061E5736A10020B8AE /* TabViewController.swift */; };
D62AC10C1E5736A10020B8AE /* TabViewControllerExtras.swift in Sources */ = {isa = PBXBuildFile; fileRef = D62AC1071E5736A10020B8AE /* TabViewControllerExtras.swift */; };
D62AC10C1E5736A10020B8AE /* TabViewController+Extras.swift in Sources */ = {isa = PBXBuildFile; fileRef = D62AC1071E5736A10020B8AE /* TabViewController+Extras.swift */; };
D62AC10D1E5736A10020B8AE /* TransparentNavigationBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = D62AC1081E5736A10020B8AE /* TransparentNavigationBar.swift */; };
D6C759781E83CFAA00471973 /* Tabman.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D6C759751E83CFA300471973 /* Tabman.framework */; };
D6C759791E83CFAA00471973 /* Tabman.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D6C759751E83CFA300471973 /* Tabman.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
Expand Down Expand Up @@ -104,7 +104,7 @@
D62AC1041E5736A10020B8AE /* ChildViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChildViewController.swift; sourceTree = "<group>"; };
D62AC1051E5736A10020B8AE /* GradientView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GradientView.swift; sourceTree = "<group>"; };
D62AC1061E5736A10020B8AE /* TabViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TabViewController.swift; sourceTree = "<group>"; };
D62AC1071E5736A10020B8AE /* TabViewControllerExtras.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TabViewControllerExtras.swift; sourceTree = "<group>"; };
D62AC1071E5736A10020B8AE /* TabViewController+Extras.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "TabViewController+Extras.swift"; sourceTree = "<group>"; };
D62AC1081E5736A10020B8AE /* TransparentNavigationBar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransparentNavigationBar.swift; sourceTree = "<group>"; };
D6C7596F1E83CFA300471973 /* Tabman.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Tabman.xcodeproj; path = ../Sources/Tabman.xcodeproj; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -160,7 +160,6 @@
D62AC0CC1E5733A80020B8AE = {
isa = PBXGroup;
children = (
D6C7596F1E83CFA300471973 /* Tabman.xcodeproj */,
D62AC0D71E5733A80020B8AE /* Tabman-Example */,
D62AC0D61E5733A80020B8AE /* Products */,
D6C759651E83CE6300471973 /* Frameworks */,
Expand All @@ -183,23 +182,21 @@
D62AC1041E5736A10020B8AE /* ChildViewController.swift */,
D601367C1E6990650013CD42 /* CustomTabmanBar.swift */,
D62AC0DC1E5733A80020B8AE /* Main.storyboard */,
D62AC10E1E5736B20020B8AE /* Example Components */,
D62AC10E1E5736B20020B8AE /* Extras */,
D62AC10F1E5736BE0020B8AE /* Resources */,
);
path = "Tabman-Example";
sourceTree = "<group>";
};
D62AC10E1E5736B20020B8AE /* Example Components */ = {
D62AC10E1E5736B20020B8AE /* Extras */ = {
isa = PBXGroup;
children = (
D62AC1071E5736A10020B8AE /* TabViewController+Extras.swift */,
D616D06D1E72E2C600C7AA32 /* PresetAppearanceConfigs.swift */,
D62AC1071E5736A10020B8AE /* TabViewControllerExtras.swift */,
D61E50CF1E647F0000AC8C75 /* Settings */,
D62AC1051E5736A10020B8AE /* GradientView.swift */,
D62AC1081E5736A10020B8AE /* TransparentNavigationBar.swift */,
D61E50BB1E64452D00AC8C75 /* CircularButton.swift */,
D6BF9D191ED6132000F24456 /* Views */,
);
name = "Example Components";
name = Extras;
sourceTree = "<group>";
};
D62AC10F1E5736BE0020B8AE /* Resources */ = {
Expand All @@ -212,9 +209,20 @@
name = Resources;
sourceTree = "<group>";
};
D6BF9D191ED6132000F24456 /* Views */ = {
isa = PBXGroup;
children = (
D62AC1051E5736A10020B8AE /* GradientView.swift */,
D62AC1081E5736A10020B8AE /* TransparentNavigationBar.swift */,
D61E50BB1E64452D00AC8C75 /* CircularButton.swift */,
);
name = Views;
sourceTree = "<group>";
};
D6C759651E83CE6300471973 /* Frameworks */ = {
isa = PBXGroup;
children = (
D6C7596F1E83CFA300471973 /* Tabman.xcodeproj */,
7BF6B4941E9555DE00BE68B5 /* Pageboy.framework */,
7BF6B4951E9555DE00BE68B5 /* PureLayout.framework */,
);
Expand Down Expand Up @@ -336,7 +344,7 @@
D616D06E1E72E2C600C7AA32 /* PresetAppearanceConfigs.swift in Sources */,
D601367D1E6990650013CD42 /* CustomTabmanBar.swift in Sources */,
D62AC10D1E5736A10020B8AE /* TransparentNavigationBar.swift in Sources */,
D62AC10C1E5736A10020B8AE /* TabViewControllerExtras.swift in Sources */,
D62AC10C1E5736A10020B8AE /* TabViewController+Extras.swift in Sources */,
D62AC10A1E5736A10020B8AE /* GradientView.swift in Sources */,
D61E50D11E6481C300AC8C75 /* SettingsItem.swift in Sources */,
D61E50CC1E646FAD00AC8C75 /* SettingsPresentTransitionController.swift in Sources */,
Expand Down
22 changes: 13 additions & 9 deletions Example/Tabman-Example/SettingsEntries.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ extension SettingsViewController {
func addItems() -> [SettingsSection] {
var sections = [SettingsSection]()

let styleOptions = [TabmanBar.Style.scrollingButtonBar.description,
TabmanBar.Style.buttonBar.description,
TabmanBar.Style.blockTabBar.description,
TabmanBar.Style.bar.description]

let indicatorStyleOptions = ["Default",
TabmanIndicator.Style.line.description,
TabmanIndicator.Style.dot.description,
TabmanIndicator.Style.chevron.description,
TabmanIndicator.Style.clear.description]

let pageVCSection = SettingsSection(title: "Page View Controller")
pageVCSection.add(item: SettingsItem(type: .toggle,
title: "Infinite Scrolling",
Expand All @@ -25,10 +36,7 @@ extension SettingsViewController {
}))

let appearanceSection = SettingsSection(title: "Appearance")
appearanceSection.add(item: SettingsItem(type: .options(values: [TabmanBar.Style.scrollingButtonBar.description,
TabmanBar.Style.buttonBar.description,
TabmanBar.Style.blockTabBar.description,
TabmanBar.Style.bar.description],
appearanceSection.add(item: SettingsItem(type: .options(values: styleOptions,
selectedValue: { return self.tabViewController?.bar.style.description }),
title: "Bar Style",
description: nil,
Expand All @@ -40,11 +48,7 @@ extension SettingsViewController {
currentAppearance: self.tabViewController?.bar.appearance)
self.tabViewController?.reloadPages()
}))
appearanceSection.add(item: SettingsItem(type: .options(values: ["Default",
TabmanIndicator.Style.line.description,
TabmanIndicator.Style.dot.description,
TabmanIndicator.Style.chevron.description,
TabmanIndicator.Style.clear.description],
appearanceSection.add(item: SettingsItem(type: .options(values: indicatorStyleOptions,
selectedValue: { return self.tabViewController?.bar.appearance?.indicator.preferredStyle?.description ?? "Default" }),
title: "Preferred Indicator Style",
description: nil,
Expand Down
76 changes: 5 additions & 71 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pod 'Tabman'
And run `pod install`.

### Carthage
Tabman is available through [Carthage](https://github.com/Carthage/Carthage). Simply install carthage with [Homebrew](http://brew.sh/) using the following command:
Tabman is also available through [Carthage](https://github.com/Carthage/Carthage). Simply install carthage with [Homebrew](http://brew.sh/) using the following command:

```bash
$ brew update
Expand Down Expand Up @@ -144,9 +144,9 @@ Where you want the bar to appear, either at the top or bottom of the screen. By
The bar will automatically take `UIKit` components such as `UINavigationBar` and `UITabBar` into account.

#### Appearance
The `TabmanBarAppearance` object provides all the available properties for appearance customisation of a `TabmanBar`. Not all of the properties are appropriate for each style `TabmanBar`, therefore the bar will only respond to the properties it adheres to.
The `TabmanBar.Appearance` object provides all the available properties for appearance customisation of a `TabmanBar`. Not all of the properties are appropriate for each style `TabmanBar`, therefore the bar will only respond to the properties it adheres to.

To set a custom appearance definition do this on a `TabmanViewController`:
To set a custom appearance definition do the following on a `TabmanViewController`:

```swift
tabViewController.bar.appearance = TabmanBar.Appearance({ (appearance) in
Expand All @@ -156,73 +156,7 @@ tabViewController.bar.appearance = TabmanBar.Appearance({ (appearance) in
})
```

The following properties are available:

```swift
/// Indicator configuration
public struct Indicator {
/// The preferred style to use for the indicator.
/// This is optionally conformed to by the bar.
public var preferredStyle: TabmanIndicator.Style?
/// The color of the bar indicator.
public var color: UIColor?
/// The weight (thickness) of the bar indicator if using a line indicator.
public var lineWeight: TabmanIndicator.LineWeight?
/// Whether the indicator transiton is progressive.
public var isProgressive: Bool?
/// Whether the indicator bounces at the end of page ranges.
public var bounces: Bool?
/// Whether the indicator compresses at the end of page ranges.
public var compresses: Bool?
/// Whether to use rounded corners on line indicators.
public var useRoundedCorners: Bool?
}

/// State configuration.
public struct State {
/// The color to use for selected items in the bar (text/images etc.).
public var selectedColor: UIColor?
/// The text color to use for unselected items in the bar (text/images etc.).
public var color: UIColor?
}

/// Text configuration
public struct Text {
/// The font to use for text labels in the bar.
public var font: UIFont?
}

/// Layout configuration
public struct Layout {
/// The spacing between items in the bar.
public var interItemSpacing: CGFloat?
/// The spacing at the edge of the items in the bar.
public var edgeInset: CGFloat?
/// The height for the bar.
public var height: TabmanBar.Height?
/// The vertical padding between the item and the bar bounds.
public var itemVerticalPadding: CGFloat?
}

/// Bar style configuration.
public struct Style {
/// The background style for the bar.
public var background: TabmanBarBackgroundView.BackgroundStyle?
/// Whether to show a fade on the items at the bounds edge of a scrolling button bar.
public var showEdgeFade: Bool?
/// Color of the separator at the bottom of the bar.
public var bottomSeparatorColor: UIColor?
}

/// Bar interaction configuration
public struct Interaction {
/// Whether user scroll is enabled on a scrolling button bar.
public var isScrollEnabled: Bool?
}
```

##### Defaults
A number of default properties are set on `TabmanBar.Appearance`, these can be viewed [here](Docs/APPEARANCE_DEFAULTS.md).
**Documentation for all the available appearance properties can be found here: [Appearance Docs](Docs/APPEARANCE.md).**

### Advanced

Expand All @@ -232,7 +166,7 @@ For more advanced customisation, including defining your own indicator and bar s
Please feel free to contact me on [Twitter](https://twitter.com/MerrickSapsford).

## Contributing
Bug reports and pull requests are welcome on GitHub at [https://github.com/MerrickSapsford/Tabman](https://github.com/uias/Tabman).
Bug reports and pull requests are welcome on GitHub at [https://github.com/uias/Tabman](https://github.com/uias/Tabman).

## License

Expand Down
Loading

0 comments on commit 375e2ae

Please sign in to comment.