Giter Site home page Giter Site logo

mohsinalimat / pomegranate Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 209 KB

Pomegranate is an open source project used to create beautiful UI and make stressful tasks easy.

License: MIT License

Ruby 3.39% Objective-C 2.47% Shell 30.20% Swift 63.93%

pomegranate's Introduction

alt text

CI Status Version License Platform

Pomegranate is all about creating easy UI for your applications. Inside this library you have a bunch of class extensions to help you build beautiful apps and make hard tasks easy.

Pomegranate is divided in 6 components:

Gradienterr

As the name suggests, this is a UIView class extension to add gradients to views. It works like this:

myView.addGradient(beginningColor: .blue, endingColor: .yellow, type:
.leftToRight, animated: true)

This will create something like this:

The possible gradient types are:

  • .leftToRight
  • .rightToLeft
  • .diagonalLeftToRight
  • .diagonalRightToLeft
  • .topToBottom
  • .bottomToTop

Other functions available:

Function Parameters Use
addGRadientWithMultipleColors() [CGColor], type, animated Adds gradient with multiple colors
deleteGradient() animated Deletes all of the gradients on the current view

Note: This will remove all of the gradients on that view.

Downloaderr

Downloading images from a URL can be awkward sometimes, that's where Downloaderr comes to the rescue. Downloaderr is a UIImageView extension used to download images from a URL and even put a placeholder while the download is happening. Downloaderr also saves your images on a temporary cache so you don't download the same image twice.

It works as follows:

 myImageView.downloadImageWith(url: NSURL(string: "https://upload.wikimedia.org/wikipedia/en/3/39/Wakerlink.jpg")!, placeholder: UIImage(named: "placeholder")!)

Other functions available:

Function Parameters Use
downloadImageFrom(url:) url download Image from a URL without placeholder

Date-Formaterr

This is a Date class extension that provides different options in converitng a string into a Date or vice versa. It works like this:

Creating Dates:

let date = Date(dateInString: "15/03/2017",dateFormat: "dd/MM/yyyy")!

Converting dates to strings:

string = date.toTimeLanguage()
string = date.toTimeLanguage([.oneDayago:"Yesterday"])
string = date.convertTo(format: .short)
string = date.convertTo(format: .custom("dd-MM-yyyy"))

Possible formats for converting dates to strings:

  • .full
  • .short
  • .medium
  • .long
  • .weekDay
  • .custom(String)

Time language formats to customize:

Format Custom string
.rightNow A moment ago
.oneDayAgo One day ago
.oneYearAgo One year ago
.yearsAgo (years) years ago
.daysAgo (days) days ago
.minutesAgo (minutes) minutes ago
.oneMinuteAgo One minute ago

Attributerr

Adding attributes to a string is pretty weird, let's face it. We decided to make it easier like such:

myLabel.attributedText = Attributerr.sharedAttributerr.create(string: "Hello World!", backgroundColor: .red, font: .systemFont(ofSize: 20), color: .blue, underLineStyle: 0)

This will create something like this:

All of the parameters except the string value have default values, so you don't need to set them all on the function call.

This are the default values used:

  • backgroundColor = .clear
  • font = UIFont(name: "System", size: 12)!
  • color = .black
  • underLineStyle = 0

This segment comes with other handy functions like the following:

Function Parameters Use
addAttributesToRange() string, NSRange, attributes Add attributes to a NSRange
addAttributesToSubstring() string, substring, attributes Adds attributes to a substring of your string

The attributes parameter is the list of available parameters that have default values.

Colorerr

This is a UIColor extension that provides popular color options to create beautiful UI.

Color options:

  • SocialMedia
  • Red
  • Green
  • Purple
  • Blue
  • Gray
  • Yellow
  • Orange
  • Pink

Each color let's you pick the intensity, for example:

UIColor.Colorerr.Blue.dark

The intensities can be:

  • dark
  • light
  • regular

Page View

This is a head start in creating a page view that is used for an introduction of an application. It looks somthing like this:

To get started in creating one, you can do this:

let vc = PageViewController()
vc.titles = ["Title1","Title2","Title3"]
self.navigationController?.pushViewController(vc, animated: true)

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

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

pod "Pomegranate"

Author

tonyyasi Jelizondo

License

Pomegranate is available under the MIT license. See the LICENSE file for more info.

pomegranate's People

Contributors

jelizondo avatar tonyyasi avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

sircomet

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.