Swiftpack.co - ahmedelserafy7/Pagie as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by ahmedelserafy7.
ahmedelserafy7/Pagie 1.0.2
A flexible library that helps you navigate between pages using gestures.
⭐️ 0
🕓 2 years ago
.package(url: "https://github.com/ahmedelserafy7/Pagie.git", from: "1.0.2")

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

GitHub

link
Stars: 0
Last commit: 2 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics