Welcome to Pagie, a flexible library that helps you navigate between pages using gestures.
Pagie is distributed using the Swift Package Manager. To install it into a project, go to file -> Swift Packages -> add it as a package dependency, then enter a package repository url which is https://github.com/ahmedelserafy7/Pagie.git
, click next and one more next, and finish.
Then import Pagie wherever you’d like to use it:
import Pagie
You can use CocoaPods by adding the following line to your Podfile
:
pod 'Pagie'
import Pagie
UIViewController
superclass, and set it to PagieHome
.class ViewController: PagieHome
Page
type, and use the initializer to set the initial value of properties title
, subtitle
, and imageName
, and set them to self.pages
.let page1 = Page(title: "Discover great events happening in your city", subtitle: "Find events by category and browse list of trending events everyday.", imageName: "page1")
let page2 = Page(title: "Maximize the value of every event you attend", subtitle: "Stay updated with event details, meet other attendees and get live announcements about important updates.", imageName: "page2")
let page3 = Page(title: "Make the most out of every event", subtitle: "View updated agenda, sessions details and speakers from your phone.", imageName: "page3")
let page4 = Page(title: "Network like a pro!", subtitle: "Join the event's community, like-minded people and shake hands through the app to keep track of your connections.", imageName: "page4")
let pages: [Page] = [page1, page2, page3, page4]
self.pages = pages
// Define how many dots you like:
pageControl.numberOfPages = self.pages.count
Assets.xcassets
file of your project.Since your app is up and running, you may need to configure, customize, and add your own page.
Customize your page control indicator color:
pageControl.pageIndicatorTintColor = .gray
Customize your "current" page control indicator color:
pageControl.currentPageIndicatorTintColor = .magenta
Change your button background color:
getStartedButton.backgroundColor = .cyan
Rename your button name:
getStartedButton.setTitle("Sign up", for: .normal)
Customize your button width and height:
customizeButton(width: 100, height: 100)
Remove your button:
getStartedButton.removeFromSuperview()
Configure getStartedButton
function:
override func handleGetStartedButton() {
print("Hello world!")
}
Setup your login page:
loginId
identifier:fileprivate let myLoginId = "myLoginId"
UICollectionViewCell
subclass for use with your collection view, so that new cells are dequeued and re-use automatically by the system:collectionView.register(MyLoginCell.self, forCellWithReuseIdentifier: myLoginId)
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
guard indexPath.item != pages.count else {
guard let loginCell = collectionView.dequeueReusableCell(withReuseIdentifier: myLoginId, for: indexPath) as? MyLoginCell else { return UICollectionViewCell() }
return loginCell
}
return setupPageCell(by: collectionView, and: indexPath)
}
UICollectionViewCell
subclass:import Pagie
class MyLoginCell: LoginCell {
override func setupViews() {
self.backgroundColor = .blue
}
}
Additional sample examples can be found in /PagieExample
.
Start out simple, and customize when needed.
Having trouble working with Pagie? Found a typo in the implementation? Interested in adding a feature or fixing a bug? Then by all means submit an issue or pull request. If this is your first pull request, it may be helpful to read up on the GitHub Flow first.
Please keep this in mind when requesting features and/or submitting pull requests:
When submitting a pull request:
master
and give it a meaningful name (e.g. my-awesome-new-feature
).Ahmed Elserafy
link |
Stars: 0 |
Last commit: 2 years ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics