Git Product home page Git Product logo

loremipsum's Introduction

Lorem Ipsum

Lorem Ipsum is a simple lorem ipsum generator for iOS and OS X apps. It supports generating text in different formats (words, sentences, paragraphs), miscelianous data (names, URLs, dates etc.) and placeholder images for both, iOS and OS X.

This project was inspired by a great static site generator Middleman. Its lorem ipsum feature was also a data source for this project.

Table of Contents

Installation

Lorem Ipsum can be integrated into your Xcode project using CocoaPods by putting following line into your Podfile and running pod install:

pod 'LoremIpsum', '~> 1.0'

Alternatively you can copy the files LoremIpsum.h and LoremIpsum.m to your project.

Usage

Wherever you want to use Lorem Ipsum functionality, import the header file.

#import "LoremIpsum.h"

Texts

NSString *word = [LoremIpsum word]; // => "voluptatem"
NSString *words = [LoremIpsum wordsWithNumber:5]; // => "est dolores voluptatem cumque itaque"
NSString *sentence = [LoremIpsum sentence]; // => "Facilis magni autem ut iure cum voluptas excepturi eos."
NSString *sentences = [LoremIpsum sentencesWithNumber:2];
NSString *paragraph = [LoremIpsum paragraph];
NSString *paragraphs = [LoremIpsum paragraphsWithNumber:2];
NSString *title = [LoremIpsum title]; // => "Et Quibusdam"

Misc Data

NSString *firstName = [LoremIpsum firstName]; // => "Dora"
NSString *lastName = [LoremIpsum lastName]; // => "Glass"
NSString *name = [LoremIpsum name]; // => "Tomas Beasley"
NSString *email = [LoremIpsum email]; // => "[email protected]"
NSURL *URL = [LoremIpsum URL]; // => "http://stumbleupon.com/"
NSString *tweet = [LoremIpsum tweet];
NSDate *date = [LoremIpsum date];

Images

Lorem Ipsum supports creating placeholder images by downloading them from following supported services:

Service Value of LIPlaceholderImageService
lorempixel.com LIPlaceholderImageServiceLoremPixel
hhhhold.com LIPlaceholderImageServiceHhhhold
dummyimage.com LIPlaceholderImageServiceDummyImage
placekitten.com LIPlaceholderImageServicePlaceKitten

Lorem Ipsum offers methods for synchronous and asynchronous downloading of images as well as retrieving the URL for an image without downloading it. All methods work for both platforms, iOS and OS X. According to the platform UIImage or NSImage instances are created.

Synchronous Downloading

UIImage *image = [LoremIpsum placeholderImageFromService:LIPlaceholderImageServicePlaceKitten
                                                withSize:CGSizeMake(250, 250)];
                                                 
NSImage *image = [LoremIpsum placeholderImageWithSize:NSMakeSize(100, 400)];

Asynchronous Downloading

[LoremIpsum asyncPlaceholderImageFromService:LIPlaceholderImageServicePlaceKitten
                                    withSize:CGSizeMake(250, 250)
                                  completion:^(UIImage *image) {
                                      // use image here
                                  }];
                                  
[LoremIpsum asyncPlaceholderImageWithSize:NSMakeSize(100, 400)
                               completion:^(NSImage *image) {
                                   // use image here
                               }];

Image URLs

NSURL *URL = [LoremIpsum URLForPlaceholderImageFromService:LIPlaceholderImageServiceDummyImage
                                                  withSize:CGSizeMake(250, 250)];

Example Projects

This repository contains two example projects for iOS and OS X where the usage of Lorem Ipsum is shown.

Author

Lukas Kubanek // lukaskubanek.com // @kubanekl

License

Usage is provided under the MIT License. See License.markdown for the full details.

loremipsum's People

Contributors

ben-ole avatar lukaskubanek avatar nguyenhuy 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.