Unique blocky identicons generator for Swift

Overview

CI Status Version License Platform Carthage compatible

⚗️ BlockiesSwift

Sample Blockies

This library is a Swift implementation of the Ethereum fork of Blockies which is intended to be used in iOS, watchOS, tvOS and macOS apps.

Blockies generates unique images (identicons) for a given seed string. Those can be used to create images representing an Ethereum (or other Cryptocurrency) Wallet address or really anything else.

Example

To run the example project, run pod try BlockiesSwift. Or clone the repo, and run pod install from the Example directory.

Installation

CocoaPods

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

pod 'BlockiesSwift'

Carthage

BlockiesSwift is compatible with Carthage, a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To install it, simply add the following line to your Cartfile:

github "Boilertalk/BlockiesSwift"

Usage

Basic usage is very straight forward. You just create an instance of Blockies with your seed and call createImage() to get your image.

import BlockiesSwift

let blockies = Blockies(seed: "0x869bb8979d38a8bc07b619f9d6a0756199e2c724")
let img = blockies.createImage()

yourImageView.image = img

This will generate an image with size set to 8 and scale set to 4. size is the width and height of the Blockies image in blocks, scale is the width and height of one block in pixels.

Per default, random colors are generated for the given seed. You can change that but keep in mind that the pattern will also change if you provide custom colors as there will be less calls to the internal random() function.

The following is a full example.

import BlockiesSwift

let blockies = Blockies(
    seed: "0x869bb8979d38a8bc07b619f9d6a0756199e2c724",
    size: 5,
    scale: 10,
    color: UIColor.green,
    bgColor: UIColor.gray,
    spotColor: UIColor.orange
)
let img = blockies.createImage()

yourImageView.image = img

The following sizes work well for most cases.

  • size: 8, scale: 3
  • size: 5, scale: 10

Sizes above 10 generate more noisy structures. If you want to generate bigger images, you can go for a set of size and scale from the above and pass a customScale value to createImage(_:).

import BlockiesSwift

let blockies = Blockies(
    seed: "0x869bb8979d38a8bc07b619f9d6a0756199e2c724",
    size: 8,
    scale: 3
)
let img = blockies.createImage(customScale: 10)

yourImageView.image = img

The image in this example would be 8 * 3 = 24x24 pixels without a custom scale. With the customScale set to 10 it will be 8 * 3 * 10 = 240x240 pixels. The customScale lets you generate bigger images with the same structure quality as the smaller ones.

Author

Koray Koska, [email protected]

License

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

You might also like...
It is a highly configurable iOS library which allows easy styling with built in styles as well as extra header and footer views so that you can make extremely unique alerts and action sheets.
It is a highly configurable iOS library which allows easy styling with built in styles as well as extra header and footer views so that you can make extremely unique alerts and action sheets.

 CFAlertViewController CFAlertViewController is a library that helps you display and customise Alerts, Action Sheets, and Notifications on iPad and i

A very useful and unique iOS library to open image picker in just few lines of code.
A very useful and unique iOS library to open image picker in just few lines of code.

ImagePickerEasy A very simple solution to implement UIImagePickerController() in your application. Requirements Swift 4.2 and above Installation Image

A TabBarController with a unique animation for selection
A TabBarController with a unique animation for selection

BATabBarController Overview Recent Versions Language Version Swift 5 2.0.1 Swift 4 1.0.1 Obj C 0.1.6 The standard TabBarController is very limited in

Someone - Someone utilizes GPT-3 to deliver a unique chat bot app experience
Someone - Someone utilizes GPT-3 to deliver a unique chat bot app experience

Someone - An IOS App Someone utilizes GPT-3 to deliver a unique chat bot app exp

Store values using unique, randomly generated identifiers

Storage Store values using unique, randomly generated identifiers. This packages consists of three types: A Storage class, a UniqueIdentifiable protoc

OpenAPI/Swagger 3.0 Parser and Swift code generator

SwagGen SwagGen is a library and command line tool for parsing and generating code for OpenAPI/Swagger 3.0 specs, completely written in Swift. Swagger

The Swift code generator for your assets, storyboards, Localizable.strings, … — Get rid of all String-based APIs!
The Swift code generator for your assets, storyboards, Localizable.strings, … — Get rid of all String-based APIs!

SwiftGen SwiftGen is a tool to automatically generate Swift code for resources of your projects (like images, localised strings, etc), to make them ty

A simple generator of PDF written in Swift.

Features | Requirements | Installation | Usage | Communication | LICENSE PDFGenerator PDFGenerator is a simple PDF generator that generates with UIVie

A tiny generator of random data for swift

SwiftRandom SwiftRandom is a tiny help suite for generating random data such as Random human stuff like: names, gender, titles, tags, conversations Ra

Bank Card Generator with Swift using SnapKit DSL 💳
Bank Card Generator with Swift using SnapKit DSL 💳

iCard BankCard & CreditCard generator with Swift 3 using SnapKit DSL iCard is a simple tool for generate Credit & Bank Card , it represent cards as UI

An attractive color generator for Swift. Ported from randomColor.js.
An attractive color generator for Swift. Ported from randomColor.js.

Random Color Swift Inspired by David Merfield's randomColor.js. It is a ported version to Swift. You can use the library to generate attractive random

The Swift code generator for your assets, storyboards, Localizable.strings, … — Get rid of all String-based APIs!
The Swift code generator for your assets, storyboards, Localizable.strings, … — Get rid of all String-based APIs!

SwiftGen SwiftGen is a tool to automatically generate Swift code for resources of your projects (like images, localised strings, etc), to make them ty

A Swift 4.2 VIPER Module Boilerplate Generator with predefined functions and a BaseViewProtocol.
A Swift 4.2 VIPER Module Boilerplate Generator with predefined functions and a BaseViewProtocol.

Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away. Are you new to VIPER Design Pattern? Want

GenStore is a lightweight swift code generator for your resources.
GenStore is a lightweight swift code generator for your resources.

GenStore is a lightweight swift code generator for your resources. GenStore can create classes for your images, colors and localized strings.

Random image generator built with Swift

Ody Ody is an easy to use random image generator built with Swift. Perfect for placeholders! Built with [Silo] silojq, [LoremPixel] images, and FillDu

A QRCode generator written in Swift.
A QRCode generator written in Swift.

QRCode 🔳 A QRCode generator written in Swift. Overview Create a new QRCode representing a URL, a string or arbitrary data. The following examples all

A software bill of materials (SBoM) generator for Swift packages

Swift Package SBoM A software bill of materials (SBoM) generator for Swift packages. Run this command to print a JSON representation of a CycloneDX SB

Swift Quote Generator App
Swift Quote Generator App

Swift_QuoteGeneratorApp UIKit을 이용하 SWIFT APP 예제 /

Laurine - Localization code generator written in Swift. Sweet!
Laurine - Localization code generator written in Swift. Sweet!

Author's note: Thanks everyone for making Laurine the TOP trending Swift repository in the world - this is amazing and very heart-warming! But this is

Comments
  • My Blockies image is wrong. What should I do?

    My Blockies image is wrong. What should I do?

    This is probably all my fault and not a problem with BlockiesSwift. I am using the library to show an image representation of my Ethereum address. I have called the initializer with my address just as is described in the README:

    Blockies(seed: "0xc78974Ea82202F0FBA3ED78490e591A3ff17D534")
    

    This produces an image like this:

    screen shot 2018-10-09 at 8 26 41 am

    However, when I enter this address on another site that uses blockies, such as Etherscan, I see an image like this:

    screen shot 2018-10-09 at 8 36 16 am

    What am I doing wrong? Do you have any suggestions for me to try?

    opened by daltonclaybrook 2
Owner
null
A simple, declarative, functional drawing framework, in Swift!

DePict - A simple, declarative, functional drawing framework. To produce a drawing, call the Draw function (just type Draw and let autocomplete do the

David Cairns 35 Sep 16, 2021
Drawing and Geometry made easy on iOS - now in Swift 3.0

InkKit Swift Support Swift 4.0 InkKit is Swift 4.0 by default, so to use that just include InkKit in your podfile: pod 'InkKit' Swift 3.2 In order to

Shaps 373 Dec 27, 2022
❄️ SVG in Swift

Snowflake ❤️ Support my apps ❤️ Push Hero - pure Swift native macOS application to test push notifications PastePal - Pasteboard, note and shortcut ma

Khoa 949 Dec 14, 2022
Conical (angular) gradient for iOS written in Swift

AEConicalGradient Conical (angular) gradient in Swift I hope that somebody will find this useful. And nice. Usage AEConicalGradient is a minion which

Marko Tadić 82 Dec 27, 2022
Powerful and easy-to-use vector graphics Swift library with SVG support

Macaw Powerful and easy-to-use vector graphics Swift library with SVG support We are a development agency building phenomenal apps. What is Macaw? Mac

Exyte 5.9k Jan 2, 2023
A lightweight XMLParser for assembling and parsing XML values written for iOS 8+ in Swift 2.

Overview Description Requirements Installation Usage Author License Description XMLParser lets you convert a pure Swift dictionary into XML string and

Eugene Mozharovsky 75 Feb 2, 2022
Unique blocky identicons generator for Swift

⚗️ BlockiesSwift This library is a Swift implementation of the Ethereum fork of Blockies which is intended to be used in iOS, watchOS, tvOS and macOS

null 57 Dec 1, 2022
A Swift collection of unique, ordered objects

Introduction OrderedSet is essentially the Swift equivalent of Foundation's NSOrderedSet/NSMutableOrderedSet. It was created so Swift would have a uni

Weebly 248 Sep 14, 2022
Swift Xid - Xid uses MongoDB Object ID algorighm1 to generate globally unique ids with base32 serialzation to produce shorter strings

Swift Xid - Xid uses MongoDB Object ID algorighm1 to generate globally unique ids with base32 serialzation to produce shorter strings

Uditha Atukorala 0 Jun 13, 2022
iPhone and iPod Touch version of Skeleton Key: is an addictive and unique puzzle game in which you shift keys around the board unlocking treasure chests. Made with cocos2d-iphone.

Skeleton Key (iOS) Skeleton Key is an addictive and unique puzzle game in which you shift keys around the board unlocking treasure chests. It's availa

null 117 Jun 6, 2022