Code Monkey home page Code Monkey logo

pagie's Introduction

Pagie

pagie1

Welcome to Pagie, a flexible library that helps you navigate between pages using gestures.

Installation

Using the Swift Package Manager

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

Using CocoaPods

You can use CocoaPods by adding the following line to your Podfile:

pod 'Pagie'

Usage

  1. First things first, all you have to do is to import it:
import Pagie
  1. Rename your UIViewController superclass, and set it to PagieHome.
class ViewController: PagieHome
  1. Create an instance of 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

Note:

  • Don't forget to add your images to the Assets.xcassets file of your project.

Demo

repetition

Powerful Customization

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:

  1. Declare your loginId identifier:
fileprivate let myLoginId = "myLoginId"
  1. Register a 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)
  1. Customize your login view cell in code:
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)
    }
  1. Create your own custom UICollectionViewCell subclass:
import Pagie
class MyLoginCell: LoginCell {
    override func setupViews() {
        self.backgroundColor = .blue
    }
}

Additional sample examples can be found in /PagieExample.

Note:

Start out simple, and customize when needed.


Contributing

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:

  • Pagie is developed completely in the open, and your contributions are more than welcome.
  • Pagie has been designed as a base for you to customize and fit your page's unique needs.
  • It’s highly recommended that you spend a few minutes familiarizing yourself with its internal implementation, so that you’ll be ready to tackle any issues or edge cases that you might encounter.

Pull Requests

When submitting a pull request:

  1. Clone the repo.
  2. Create a branch off of master and give it a meaningful name (e.g. my-awesome-new-feature).
  3. Open a pull request on GitHub and describe the feature or fix.

Credits

Creator

Ahmed Elserafy

pagie's People

Contributors

ahmedelserafy7 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.