BlockiesSwift - 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...
FacebookImagePicker is Facebook album photo picker written in Swift.
FacebookImagePicker is Facebook album photo picker written in Swift.

Features • Installation • Usage • Translation • License GBHFacebookImagePicker is Facebook's album photo picker written in Swift, built to provide a s

GPUImage 2 is a BSD-licensed Swift framework for GPU-accelerated video and image processing.
GPUImage 2 is a BSD-licensed Swift framework for GPU-accelerated video and image processing.

GPUImage 2 Brad Larson http://www.sunsetlakesoftware.com @bradlarson [email protected] Overview GPUImage 2 is the second generation of th

GPUImage 3 is a BSD-licensed Swift framework for GPU-accelerated video and image processing using Metal.
GPUImage 3 is a BSD-licensed Swift framework for GPU-accelerated video and image processing using Metal.

GPUImage 3 Janie Clayton http://redqueengraphics.com @RedQueenCoder Brad Larson http://www.sunsetlakesoftware.com @bradlarson contact@sunsetlakesoftwa

A lightweight generic cache for iOS written in Swift with extra love for images.
A lightweight generic cache for iOS written in Swift with extra love for images.

Haneke is a lightweight generic cache for iOS and tvOS written in Swift 4. It's designed to be super-simple to use. Here's how you would initalize a J

A lightweight and fast image loader for iOS written in Swift.

ImageLoader ImageLoader is an instrument for asynchronous image loading written in Swift. It is a lightweight and fast image loader for iOS. Features

A Swift implementation of fastimage. Supports PNG, GIF, and JPEG.
A Swift implementation of fastimage. Supports PNG, GIF, and JPEG.

ImageScout ImageScout is a Swift implementation of fastimage. It allows you to find the size and type of a remote image by downloading as little as po

A Swift client library for generating URLs with imgix

imgix-swift is a client library for generating image URLs with imgix. Written in Swift, but can be used with Objective-C codebases as well. Installati

Kingfisher is a powerful, pure-Swift library for downloading and caching images from the web
Kingfisher is a powerful, pure-Swift library for downloading and caching images from the web

Kingfisher is a powerful, pure-Swift library for downloading and caching images from the web. It provides you a chance to use a pure-Swift way to work

🍁🥓 Lightweight and fast Swift library for image downloading, caching and transformations
🍁🥓 Lightweight and fast Swift library for image downloading, caching and transformations

MapleBacon Introduction MapleBacon is a lightweight and fast Swift library for downloading and caching images. Example The folder Example contains a s

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
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

Jose Quintero 46 Dec 14, 2020
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

Alexander Schuch 730 Dec 12, 2022
iOS hashtag generator, using image analysis and discovery

Tagger Description Want to be popular on some social network easily? Use Tagger to make your account content more popular and to raise your popularity

Ivan Magda 44 Dec 17, 2022
A random photo generator from unsplash for iOS

Random Photo App for IOS How it works It is a random photo generator from unsplash. Everytime you press the button, a random photo appears and the bac

Stefan Istoc 2 Feb 2, 2022
React-native-image-generator - Library to generate images from layers

react-native-image-generator Library for generate images from other images Insta

Evgeny Usov 13 Nov 16, 2022
SwiftUI App Icon Generator App for iOS & macOS Catalyst

SwiftUI App Icon Generator App for iOS & macOS Catalyst Generate Asset Icons easily to your iPhone, iPad, Mac, and Apple Watch Features The app has se

Alfian Losari 21 Sep 14, 2022
API surface for Swift plug-ins using the Swift Plugin Manager

SwiftPlugin The minimal API surface required for the Swift Plugin Manager to create instances from a loaded plugin. Additional documentation and refer

Joakim Hassila 2 Mar 25, 2022
Contentful.swift : Swift Delivery SDK for Contentful

contentful.swift - Swift Delivery SDK for Contentful Swift SDK for the Contentfu

An Tran 1 Jan 6, 2022
Swift Package Manager command plugin for Swift-DocC

Swift-DocC Plugin The Swift-DocC plugin is a Swift Package Manager command plugin that supports building documentation for SwiftPM libraries and execu

Apple 225 Dec 24, 2022
Agrume - 🍋 An iOS image viewer written in Swift with support for multiple images.

Agrume An iOS image viewer written in Swift with support for multiple images. Requirements Swift 5.0 iOS 9.0+ Xcode 10.2+ Installation Use Swift Packa

Jan Gorman 601 Dec 26, 2022