LoremSwiftum is a lightweight lorem ipsum generator for Server Side Swift. It supports generating texts in different formats (words, sentences, paragraphs) and miscellaneous data (names, URLs etc.). This framework is a reimplementation of the library LoremIpsum written in Objective-C.
Note the original Swift 2.3 iOS/OS X port is located here: lukaskubanek/LoremSwiftum
- Swift 3.0+
Add the following to your Package.swift file:
.Package(
url: "https://github.com/iamjono/LoremSwiftum.git",
majorVersion: 1, minor: 0
),Then, regenerate your Xcode project:
swift package generate-xcodeproj
To use in a project file, import the package:
import LoremSwiftum Generate a single sentence of Lorem Ipsum of between 4 and 16 words:
var str = Lorem.sentenceGenerate "n" sentences of Lorem Ipsum of between 4 and 16 words:
var str = Lorem.sentences(count: Int)Generate a single paragraph of Lorem Ipsum of between 3 and 9 sentences:
var str = Lorem.paragraphGenerate "n" paragraphs of Lorem Ipsum of between 3 and 9 sentences:
var str = Lorem.paragraphs(count: Int)Generate a title of between 2 and 7 words:
var str = Lorem.titleGenerate a random single word from the Lorem Ipsum "dictionary":
var str = Lorem.wordGenerate "n" words from the Lorem Ipsum "dictionary":
var str = Lorem.words(count: Int)Generate a random single email from the Lorem Ipsum "dictionary":
var str = Lorem.emailGenerate a random single first name from the Lorem Ipsum "dictionary":
var str = Lorem.firstnameGenerate a random single last name from the Lorem Ipsum "dictionary":
var str = Lorem.lastnameGenerate a random single name (first and last) from the Lorem Ipsum "dictionary":
var str = Lorem.nameGenerate a random single tweet from the Lorem Ipsum "dictionary":
var str = Lorem.tweetGenerate a random single url from the Lorem Ipsum "dictionary":
var str = Lorem.URLLukas Kubanek // lukaskubanek.com // @kubanekl
Jonathan Guthrie // https://github.com/iamjono @iamjono - Swift 3 port & SPM integration.
LoremSwiftum is released under the MIT License.