Skip to content

Commit

Permalink
Update cocoapods
Browse files Browse the repository at this point in the history
  • Loading branch information
tamanyan committed Oct 29, 2019
2 parents b23b088 + 4bd845b commit 0356f6e
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 2 deletions.
62 changes: 62 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,68 @@ This library is inspired by [msaps/Pageboy](https://github.com/msaps/Pageboy), [

## How to use

### Example

Here is an example of how to SwiftPageMenu.

[PageMenuExample/Sources/PageTabMenuViewController.swift](https://github.com/tamanyan/SwiftPageMenu/blob/master/PageMenuExample/Sources/PageTabMenuViewController.swift)

```swift
import UIKit
import SwiftPageMenu
// import Swift_PageMenu if you use cocoapods

class PageTabMenuViewController: PageMenuController {

let items: [[String]]

let titles: [String]

init(items: [[String]], titles: [String], options: PageMenuOptions? = nil) {
self.items = items
self.titles = titles
super.init(options: options)
}
}

extension PageTabMenuViewController: PageMenuControllerDataSource {

func viewControllers(forPageMenuController pageMenuController: PageMenuController) -> [UIViewController] {
return self.items.map(ChildViewController.init)
}

func menuTitles(forPageMenuController pageMenuController: PageMenuController) -> [String] {
return self.titles
}

func defaultPageIndex(forPageMenuController pageMenuController: PageMenuController) -> Int {
return 0
}
}

extension PageTabMenuViewController: PageMenuControllerDelegate {

func pageMenuController(_ pageMenuController: PageMenuController, didScrollToPageAtIndex index: Int, direction: PageMenuNavigationDirection) {
// The page view controller will begin scrolling to a new page.
print("didScrollToPageAtIndex index:\(index)")
}

func pageMenuController(_ pageMenuController: PageMenuController, willScrollToPageAtIndex index: Int, direction: PageMenuNavigationDirection) {
// The page view controller scroll progress between pages.
print("willScrollToPageAtIndex index:\(index)")
}

func pageMenuController(_ pageMenuController: PageMenuController, scrollingProgress progress: CGFloat, direction: PageMenuNavigationDirection) {
// The page view controller did complete scroll to a new page.
print("scrollingProgress progress: \(progress)")
}

func pageMenuController(_ pageMenuController: PageMenuController, didSelectMenuItem index: Int, direction: PageMenuNavigationDirection) {
print("didSelectMenuItem index: \(index)")
}
}
```

### DataSource

SwiftPageMenu supports adding your own custom data sources.
Expand Down
4 changes: 2 additions & 2 deletions Swift_PageMenu.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = "Swift_PageMenu"
s.version = "1.4.1"
s.version = "1.4.2"
s.summary = "Customizable Page Tab Menu Controller 👍"
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.homepage = "https://github.com/tamanyan/SwiftPageMenu"
Expand All @@ -17,5 +17,5 @@ Pod::Spec.new do |s|
s.requires_arc = true
s.source_files = 'Sources/**/*.{swift}'
s.swift_version = "5.0"
s.ios.deployment_target = '12.0'
s.ios.deployment_target = '10.0'
end

0 comments on commit 0356f6e

Please sign in to comment.