-
Install using CocoaPods:
Add the following line to the project's Podfile:pod 'Legofy'
runpod install
-
Manually:
Drag Classes folder to your project directory and add brick images from Resources into Assets folder of the project.
Import module:
import Legofy
Initialize service:
let legofyService = LegofyService(sourceImage: srcImage, brickSize: 50.0, brickType: .legoV2)
Setup delegate:
legofyService?.delegate = self
Use isPercentProgressEnabled to get progress in percents instaed of default Float value
legofyService?.isPercentProgressEnabled = true
Brick types available:
enum BrickType {
case clean, legoV1, legoV2, legoV3, custom(UIImage)
}
Blend modes available:
enum BlendMode {
case multiply, hardLight, colorBurn, difference
}
Call 'generateImage' to generate image:
legofyService?.generateImage()
Or 'generateBrickTileImages' to generate brick tiles and positions (columns/rows):
legofyService?.generateBrickTileImages()