A Swift package that provides convenient Lorem Ipsum text, images, colors and other placeholders for rapidly prototyping, building and testing your iOS applications.

Overview

ios tv watchOS mac

Lorem

Introducing Lorem, a placeholder generator library for iOS to help you rapidly prototype, build and test your iOS applications.

Lorem sample

By leveraging Swift generics we're also able to provide a simple, consistent API to make it easier to discover and even find all references when you're ready to remove your placeholder data.

// When used in a context where a simple String is required
Lorem.title // return String

// But if we use the same code inside a SwiftUI View
var body: some View {
    Lorem.title // returns Text
}

Why?

Lorem placeholder content is extremely useful when prototyping or even while building your apps while live data is unavailable or just not feasible to access yet.

Its also incredibly useful when running both manual and automation test suites, as it allows for a more controlled and/or varied set of values to be tested, revealing layout and other issues that may have been missed or difficult to reproduce otherwise.

Lastly, Lorem data is more clearly placeholder data, which can help stakeholders and other team members better identify where live-data is yet to be implemented.

Features

Lorem supports various placeholder APIs, including:

  • Strings
  • Dates
  • URLs
  • Images
  • SwiftUI View's

While most features are supported across all platforms and version, some (like AsyncImage) are only available in supported environments.

In addition to text and images, Lorem also provides useful APIs for working with other types, including Color:

Lorem sample

Most APIs also have multiple convenience features to improve the experience where applicable:

// Format dates
Lorem.date(.formatted("HH:mm"))
Lorem.date(.styled(time: .shortened))

// 3 to 5 words
Lorem.title(3...5)

// returns the same grayscale image every time
Lorem.image(source: .seed(0), grayscale: true)

Usage

The most basic usage can be achieved using simple String:

Lorem.word
Lorem.sentence
Lorem.paragraph
Lorem.title
Lorem.name
Lorem.url
Lomem.email
Lorem.date

Since Lorem supports Swift Generics, you can also use it in more contexts:

let url: URL = Lorem.url
let date: Date = Lorem.date

Which also means all of the APIs are also available conveniently in SwiftUI

Lorem.title  // Text
Lorem.color  // Color
Lorem.image  // Image

Primitives are also available which allows for usage in more scenarios, including UIKit:

Lorem.url    // URL
Lorem.date   // Date
Lorem.color  // Color, UIColor, NSColor
Lorem.image  // Image, UIImage, NSImage

Advanced

Lorem provides access to its underlying placeholder data primitives, as well as a reusable composer that simplifies text generation. This enables you to easily create custom Lorem placeholders for content where the library doesn't quite meet your needs.

let keywords = Lorem.Composer(
    Lorem.word,
    countRange: 5...15,
    separator: ", ",
    terminator: ""
)

// tempora, fugit, sit, molestias, suscipit, voluptate, et, numquam, et, voluptatem, et

Additionally, Lorem provides convenient access to its data sources, so you can build placeholders with the same data used to build the API.

Lorem.Data.words
Lorem.Data.firstNames
Lorem.Data.lastNames
Lorem.Data.siteDomains
Lorem.Data.emailDomains
// etc

Installation

You can install manually (by copying the files in the Sources directory) or using Swift Package Manager (preferred)

To install using Swift Package Manager, add this to the dependencies section of your Package.swift file:

.package(url: "https://github.com/Thirdfort/Lorem.git", .upToNextMinor(from: "1.0.0"))

You might also like...
Yummies is my first attempt at building a native iOS app using Swift and SwiftUI

Yummies is my first attempt at building a native iOS app using Swift and SwiftUI. A recipe browser where you can pin your favorite ones. Powered by Edamam Recipe Search API.

This is MVP pattern testing with Swift.
This is MVP pattern testing with Swift.

sample-swift-mvp MVP 패턴에 대한 이해를 높이기 위해서 샘플 코드 작성 및 기록 MVP 패턴 MVP(Model-View-Presenter) 패턴은 소프트웨어 아키텍처 패턴이다 M (Model) - 데이터 모델 - 실질적인 데이터 V (View) - M

Create an easy to peek SwiftUI View to showcase your own data, catalog, images, or anything you'd like.
Create an easy to peek SwiftUI View to showcase your own data, catalog, images, or anything you'd like.

Create an easy to peek SwiftUI View to showcase your own data, catalog, images, or anything you'd like.

A testing MQTT react native library

react-native-awesome-testing abc Installation npm install react-native-awesome-testing Usage import { multiply } from "react-native-awesome-testing";

Repository to help people learning testing

Testing Training The purpose of this repository is to help people learn the basics of testing in Swift. I decided to prepare this repository because m

A Kotlin multiplatform library for building dynamic server-driven UI
A Kotlin multiplatform library for building dynamic server-driven UI

Component Box · A Kotlin multiplatform library for building dynamic server-driven UI. Material Component-Based Interoperable Dynamic What You See Is W

Billboard - Add a text to your Mac menu bar
Billboard - Add a text to your Mac menu bar

📰 Billboard Put text on your Mac status bar This is a little app that allows to

Fridax enables you to read variables and intercept/hook functions in Xamarin/Mono JIT and AOT compiled iOS/Android applications.

Fridax is a Node package for dealing with Xamarin applications while using the Frida API. Goal • Installation • Usage • Examples • Issues • License Bu

FlutterNativeDragAndDrop - A package that allows you to add native drag and drop support into your flutter app
FlutterNativeDragAndDrop - A package that allows you to add native drag and drop support into your flutter app

native_drag_n_drop A package that allows you to add native drag and drop support

Owner
Thirdfort Limited
Thirdfort Limited
A zero-code template app that demonstrates how to use TheraForge's APIs and can be used for fast prototyping

TheraForge MagicBox 1.0.0-beta The Open TheraForge (OTF) MagicBox app is a template for creating digital health solutions that help people better mana

TheraForge 0 Dec 23, 2021
A package for building sentence-based UI in SwiftUI

SentenceUI SentenceUI is an SwiftUI package for building form interfaces with natural language. Features The goal for SentenceUI is to make it as easy

Ricky 5 Dec 6, 2022
MacLookup - Lookup for all Mac names, colors, model identifiers and part numbers

MacLookup Lookup for all Mac names, colors, model identifiers and part numbers.

Voyager Software Inc. 2 Jan 4, 2022
Flutter package for detecting NSFW images and videos using native implementation

Flutter NSFW 1- Download, tflite modle and put it in assets folder 2 - Add the path of the tfliet to pubspec.yaml 3 - Read the file using path_provide

Syed Ahsan Ali 8 Oct 16, 2022
Enables easy, convenient asynchronous asset loading in RealityKit for many different kinds of assets.

RealityKit Asset Loading Discussion This package includes classes and examples that enable easy, convenient asynchronous asset loading in RealityKit f

Grant Jarvis 7 Dec 23, 2022
The app allows the user to change text color and text content when the displayed button is clicked

Hello World! App Description This application allows the user to change text color and text content when the displayed button is clicked. App Walk-tho

null 0 Mar 15, 2022
Use this template as a starting point for any Swift 5 module that you want other people to include in their projects

Swift 5 Module Template Use this template as a starting point for any Swift 5 mo

James Knipe 0 Dec 28, 2021
Static Native Template and Dynamic Styling without any other app release

FileManager Project Students and Freshers, Good opportunity for you to learn and contribute in this project. Here you would learn how you can change t

Naveen Chauhan 3 Nov 30, 2021
Challenging each other to complete pet projects!

Podlodka Pet Project Challenge Мотивируем друг друга на завершение своих пет проджектов! Каждую неделю каждый участник вносит в банк 1 ставку и ведет

Vladimir Korolev 2 Aug 27, 2022
A custom calculator for deg to rad conversion & the other way round

Lilium Features A custom calculator for deg to rad conversion & the other way round. How to use Slide up the dock and you should see Lilium. An activa

null 2 Nov 20, 2022