DieCast is a library for convert the material (e.g. number) to the image in Swift.
- Insert
github "taketin/DieCast" ~> 0.1.1
to your Cartfile. - Run
carthage update
. - Link your app with
DieCast.framework
inCarthage/Build
- Insert
pod 'DieCast', '~> 0.1.1'
to your Podfile. - Run
pod install
Look at Demo
App. very easy.
if let diecast = DieCast(material: 1234567890) {
let diecastView = diecast.press()
view.addSubview(diecastView)
}
If you want to use your own images with Asset Catalog, Please follow.
(The numbers of the image, please put the file name from 0 to 9 after the prefix.)
if let diecast = DieCast(material: 1234567890, type: IntCast.Custom, filenamePrefix: "your_image_prefix_") {
...
}
magnification
height
margin
Please follow.
if let diecast = DieCast(material: 1234567890) {
// setting to magnification of image.
diecast.magnification = 0.06
// setting to height of image, width will be the same ratio.
// (magnification will be applied in priority.)
diecast.height = 50
// setting to margin of each images.
diecast.margin = 5.0
let diecastView = diecast.press()
view.addSubview(diecastView)
}
DieCast is released under the MIT license.