Skip to content

Commit

Permalink
Merge pull request #31 from xmartlabs/code-doc
Browse files Browse the repository at this point in the history
Code doc
  • Loading branch information
Martin Barreto authored Jul 30, 2021
2 parents f24bccd + 6697911 commit 20eeaba
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 2 deletions.
Binary file added Example/Media/LogOutExample.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Example/Media/instagramStyleExample.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Example/Media/twitterStyleExample.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ PagerTabStrip is the first pager view built in pure SwiftUI. It provides PagerTa
<tr>
<th><img src="Example/Media/twitterStyleExample.gif" width="250"/></th>
<th><img src="Example/Media/instagramStyleExample.gif" width="250"/></th>
<th><img src="Example/Media/youtubeStyleExample.gif" width="250"/></th>
<th><img src="Example/Media/LogOutExample.gif" width="250"/></th>
</tr>
</table>

Expand Down
4 changes: 4 additions & 0 deletions Sources/PagerTabViewStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ import Foundation
import SwiftUI

public struct PagerTabViewStyle {
/// The space between navigation bar tab items. This parameter is 0 by default.
var tabItemSpacing: CGFloat
/// The height of the navigation bar. This parameter is 50 by default.
var tabItemHeight: CGFloat
/// The height of the indicator bar. This parameter is 2 by default.
var indicatorBarHeight: CGFloat
/// The height of the indicator bar. This parameter is blue by default.
var indicatorBarColor: Color

public init(tabItemSpacing: CGFloat = 0, tabItemHeight: CGFloat = 50, indicatorBarHeight: CGFloat = 2, indicatorBarColor: Color = .blue){
Expand Down
15 changes: 14 additions & 1 deletion Sources/View+Modifiers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,27 @@
import SwiftUI

extension View {

/// Sets the navigtion bar item associated with this page.
///
/// - Parameter pagerTabView: The navigation bar item to associate with this page.
public func pagerTabItem<V>(@ViewBuilder _ pagerTabView: @escaping () -> V) -> some View where V: View {
return self.modifier(PagerTabItemModifier(navTabView: pagerTabView))
}

/// Adds an action to perform when the user switches to this page, either by scrolling to it or tapping its tab.
/// This modifier is applied to a specific page.
///
/// - Parameter action: The action to perform.
///
/// - Returns: A view that triggers `action` when this view appears.
public func onPageAppear(perform action: (() -> Void)?) -> some View {
return self.modifier(PagerSetAppearItemModifier(onPageAppear: action ?? {}))
}


/// Sets the style for the pager view within the the current environment.
///
/// - Parameter style: The style to apply to this pager view.
public func pagerTabStripViewStyle(_ style: PagerTabViewStyle) -> some View {
return self.environment(\.pagerTabViewStyle, style)
}
Expand Down

0 comments on commit 20eeaba

Please sign in to comment.