Giter VIP home page Giter VIP logo

swiftpages's Introduction

Version License Platform

Features

---
  • A simple yet beautifully architected solution for management of paged-style view controllers.
  • Dynamic loading of view controllers, allowing handling of high amounts of data without compromising memory.
  • Supports all orientations.
  • Highly customisable, all items have clean API’s to change them to any appearance or size.
  • Can be sized and positioned anywhere within a view controller.
  • Extensively documented code for quick understanding.

Installation

---

CocoaPods

SwiftPages is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "SwiftPages"

Manual

Just Include the SwiftPages.swift file found on the demo in your project, and you’re good to go!

Usage

---

Using SwiftPages in your project is very simple and straightforward.

Create a SwiftPages Instance

First create your SwiftPages instance, there are two ways to do it, as an IBOoutlet of a view of type SwiftPages from the storyboard, or programmatically:

As an IBOoutlet of a view of type SwiftPages from the storyboard
Place a UIView in your view controller and assign its constraints, make its class be of type SwiftPages. Then control drag to your view controller as an IBOutlet.

As a fully programmatic SwiftPages view.
Declare it in the viewDidLoad function of your view controller and set the desired position and size:

let swiftPagesView : SwiftPages!
swiftPagesView = SwiftPages(frame: CGRectMake(0, 0, self.view.frame.width, self.view.frame.height))

Then, after the initialization (described below), add it as a subview on your view controller:

self.view.addSubview(swiftPagesView)

Initialization

SwiftPages can be initialized in one of two ways:

Initialize with images as buttons on the top bar:
First create an array of strings, the strings will be the Storyboard ID's of the view controllers you would like to include:

var VCIDs : [String] = ["FirstVC", "SecondVC", "ThirdVC", "FourthVC", "FifthVC"]

Then create an array of UIImages which will correlate in order to the VC ID's array created above, it also has to have the same number of items as the aforementioned array:

var buttonImages : [UIImage] = [UIImage(named:"HomeIcon.png")!,
                                        UIImage(named:"LocationIcon.png")!,
                                        UIImage(named:"CollectionIcon.png")!,
                                        UIImage(named:"ListIcon.png")!,
                                        UIImage(named:"StarIcon.png")!]

Finally, use the initializeWithVCIDsArrayAndButtonImagesArray function with the two arrays created:

swiftPagesView.initializeWithVCIDsArrayAndButtonImagesArray(VCIDs, buttonImagesArray: buttonImages)

Initialize with text on buttons:
First, alike with the image initialization, create an array of strings, the strings will be the Storyboard ID's of the view controllers you would like to include:

var VCIDs : [String] = ["FirstVC", "SecondVC", "ThirdVC", "FourthVC", "FifthVC"]

Then create an array of titles which will correlate in order to the VC ID's array created above, it must have the same number of items as the aforementioned array:

var buttonTitles : [String] = ["Home", "Places", "Photos", "List", "Tags"]

Finally, use the initializeWithVCIDsArrayAndButtonTitlesArray function with the two arrays created:

swiftPagesView.initializeWithVCIDsArrayAndButtonTitlesArray(VCIDs, buttonTitlesArray: buttonTitles)

Customisation

---

Once you have your SwiftPages instance you can customize the appearance of all item's using the class API's, to view the API list look for the API's Mark on the SwiftPages class. Below is a brief customization sample:

swiftPagesView.enableAeroEffectInTopBar(true)
swiftPagesView.setButtonsTextColor(UIColor.whiteColor())
swiftPagesView.setAnimatedBarColor(UIColor.whiteColor())

Example

---

You can find a full example on usage and customization on the Xcode project attached to this repository.

License

---

The MIT License (MIT)

Copyright (c) 2015 Gabriel Alvarado ([email protected])

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

swiftpages's People

Contributors

gabrielalva avatar wjiuxing avatar victorg1991 avatar andres-ciano-umewin avatar didats avatar delannoyk avatar

Watchers

Maximiliano José Sorribas 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.