VBRProceduralStrings
UIImageView extension for procedural generation of beautiful svg shapes
Description
Installation
CocoaPods
VBRProceduralStrings is available on CocoaPods. Just add the following to your project Podfile:
pod 'VBRProceduralStrings'
Or from GitHub:
pod 'VBRProceduralStrings', :git => 'https://github.com/v-braun/VBRProceduralStrings.git'
VBRProceduralStrings use Macaw to parse the generated SVG content and render it on an CALayer. You should add it also to your Podfile
Manually
- Download and drop
VBRProceduralStrings.swift
in your project. - Add Macaw to your project
- Congratulations!
Usage
Create an UIView
let settings = ProcStringsSettings()
// _svgView is a placeholder that was setup on the main view via interfacebuilder
// see the example project for that
// you should do that in viewDidAppear that guarantee that width and hight has correct values
settings.width = Float(_svgView.bounds.width)
settings.height = Float(_svgView.bounds.height)
settings.lines = 100
settings.points = 8
// horizontal gradients
settings.gradients.append(GradientStep(offset: 0, color: "#03a9f4"))
settings.gradients.append(GradientStep(offset: 70, color: "#e91e63"))
let subView = ProceduralStringGenerator.generateSVGUIView(settings: settings)
self.addSubView(subView)
Create an UIImage
let settings = ProcStringsSettings()
settings.width = 420
settings.height = 240
settings.lines = 100
settings.points = 8
// horizontal gradients
settings.gradients.append(GradientStep(offset: 0, color: "#03a9f4"))
settings.gradients.append(GradientStep(offset: 70, color: "#e91e63"))
let image = ProceduralStringGenerator.generateSVGImage(settings: settings)
Create a SVG String
let settings = ProcStringsSettings()
settings.width = 420
settings.height = 240
settings.lines = 100
settings.points = 8
// horizontal gradients
settings.gradients.append(GradientStep(offset: 0, color: "#03a9f4"))
settings.gradients.append(GradientStep(offset: 70, color: "#e91e63"))
let svgString = ProceduralStringGenerator.generateSVGString(settings: settings)
Use UIImageView extension
let settings = ProcStringsSettings()
settings.width = 420
settings.height = 240
settings.lines = 100
settings.points = 8
// horizontal gradients
settings.gradients.append(GradientStep(offset: 0, color: "#03a9f4"))
settings.gradients.append(GradientStep(offset: 70, color: "#e91e63"))
myUIImageView.generate(settings: settings)
Authors
Contributing
Make sure to read these guides before getting started:
License
VBRProceduralStrings is available under the MIT License. See LICENSE for details.