QR code generator in Swift, with no external dependencies.

Overview

QRDispenser is a lightweight library to generate a QR code as image (UIImage) in your app. It uses only native components, with no dependency from other libraries. This allows you to also fork the project and write your own implementation in case you need it, without worrying about external frameworks.

Structure

The structure of the library is simple: there's only one class that you use and it's the QRDispenser. It has these methods:

  • generate(from: String)
  • generate(url: URL)
  • generate(email: String)
  • generate(phoneNumber: String)
  • generate(wiFiSSID: String, password: String, encryption: WiFiEncryption)
  • generate(latitude: Double, longitude: Double, altitude: Double)
  • generate(location: CLLocation)

Every method returns a UIImage object or throws an error. The error enumeration is QRDispenserError. The code is well documented about every method, if you need more details check directly on Xcode.

There's also a nice thing that I plan to expand in the future that is an extension for URL. The extension has a computed property that returns a QR code containing the url, if the url is a network url (no local ones for now). It works like this:

let url = "https://andrealufino.com"

let qrImage = url.qrRepresentation

I'd like to expand this kind of structure also to other types, like strings, contacts and events.

iOS version

This library needs at least iOS 14.

Installation

The library is available via Swift Package Manager. Just add the url of this repository.

Author

Andrea Mario Lufino, iOS developer since 2010.

You might also like...
Write less UI code
Write less UI code

Layoutless Layoutless enables you to spend less time writing UI code. It provides a way to declaratively style and layout views. Here is an example of

Write concise Autolayout code
Write concise Autolayout code

Winner of Hacking with Swift Recommended award You + Stevia = πŸ¦„ πŸ’‘ Write concise, readable layouts πŸ– Reduce your maintenance time 🎨 Compose your st

An easier and faster way to code Autolayout
An easier and faster way to code Autolayout

EZAnchor 中文介绍 An easier way to code Autolayout Are you annoyed of coding .active = true while using Autolayout Anchors over and over again? Are you an

The fast path to autolayout views in code
The fast path to autolayout views in code

NorthLayout The fast path to autolayout views in code Talks https://speakerdeck.com/banjun/auto-layout-with-an-extended-visual-format-language at AltC

CompositionalLayoutDSL, library to simplify the creation of UICollectionViewCompositionalLayout. It wraps the UIKit API and makes the code shorter and easier to read.
CompositionalLayoutDSL, library to simplify the creation of UICollectionViewCompositionalLayout. It wraps the UIKit API and makes the code shorter and easier to read.

CompositionalLayoutDSL CompositionalLayoutDSL is a Swift library. It makes easier to create compositional layout for collection view. Requirements Doc

A collection of operators and utilities that simplify iOS layout code.

Anchorage A lightweight collection of intuitive operators and utilities that simplify Auto Layout code. Anchorage is built directly on top of the NSLa

UIView category which makes it easy to create layout constraints in code

FLKAutoLayout FLKAutoLayout is a collection of categories on UIView which makes it easy to setup layout constraints in code. FLKAutoLayout creates sim

This app presents few examples for common patterns using purer SwiftUI code

VIPERtoSwiftUI GOAL This app presents few examples for common patterns using purer (from authors experience) SwiftUI code. LITERATURE https://www.appy

Using the UIKitChain framework, You can create a UIKit component in one line of code.
Using the UIKitChain framework, You can create a UIKit component in one line of code.

Using the UIKitChain framework, You can create a UIKit component in one line of code. Installation CocoaPods CocoaPods is a dependency manager for Coc

Comments
  • Responsive logo in Readme

    Responsive logo in Readme

    Previously the logo had a fixed height which lead to it not being displayed properly on mobile devices. I changed the width to be relative and removed the height tag. This way the image retains its aspect ratio independent of the display size.

    opened by GuchenGit 1
Releases(1.0.1)
Owner
Andrea Mario Lufino
Senior iOS Developer πŸ‘¨πŸ»β€πŸ’»
Andrea Mario Lufino
Random-Colors-iOS - Random colors generator app with auto layout

Random Colors Random colors generator app with auto layout Demo demo.mp4 Depende

Adem Γ–zcan 8 Mar 23, 2022
Fast Swift Views layouting without auto layout. No magic, pure code, full control and blazing fast. Concise syntax, intuitive, readable & chainable. [iOS/macOS/tvOS/CALayer]

Extremely Fast views layouting without auto layout. No magic, pure code, full control and blazing fast. Concise syntax, intuitive, readable & chainabl

layoutBox 2.1k Dec 22, 2022
Written in pure Swift, QuickLayout offers a simple and easy way to manage Auto Layout in code.

QuickLayout QuickLayout offers an additional way, to easily manage the Auto Layout using only code. You can harness the power of QuickLayout to align

Daniel Huri 243 Oct 28, 2022
πŸŽ„ Advent of Code ’21 solutions in Swift

Advent of Code '21 My solutions to this years Advent of Code challenge written in Swift. Content Day 1: Sonar Sweep solution Day 2: Dive! solution Day

Witek Bobrowski 2 Dec 1, 2022
A Swift playgrounds with solutions of the Advent of Code 2021 challenge.

?? Advent of Code 2021 ?? A Swift playgrounds with solutions of the Advent of Code 2021. How to run Clone the repo and open the Playground in Xcode. S

Tommaso Madonia 3 Dec 5, 2022
A Code challenge I solved leveraging a lot on Composite collection view layout written in swift

AsthmApp Mobile app designed as a support aid for people with Asthma Accounts Google and Firebase [email protected] dICerytiMPSI Facebook asthmp.ap

null 0 Dec 13, 2021
A Code challenge I solved leveraging a lot on Composite collection view layout...written in swift

Space44 Code Challenge Space44 Code Challenge iOS application for Space 44 hiring process, it leverages on Image download and composite collection vie

null 0 Dec 16, 2021
Fast Swift Views layouting without auto layout. No magic, pure code, full control and blazing fast

Fast Swift Views layouting without auto layout. No magic, pure code, full control and blazing fast. Concise syntax, intuitive, readable & chainable. [iOS/macOS/tvOS/CALayer]

layoutBox 2.1k Jan 2, 2023
A tool that generate code for Swift projects, designed to improve the maintainability of UIColors

SwiftColorGen A tool that generate code for Swift projects, designed to improve the maintainability of UIColors. Please notice, this tool still under

Fernando del Rio 150 Oct 23, 2022
An extension that simplifies the work with Swift AutoLayout by writing cleaner, more natural and easy-reading code.

Installation For now you're able to clone repo in your project or download ZIP folder manually. git clone https://github.com/votehserxam/AutoLayout.gi

Max 3 Nov 8, 2022