A Preset
is an object that contains information for a screen size.
An example Preset
object:
{
"title" : "iPhone 7",
"width" : 375,
"height" : 667
}
A collection of presets is a json file. The file has a dictionary with 2 keys:
platforms
- An array of the platforms contained in the collection.presets
- A dictionary with an array of presets for each item inplatforms
. Example:
{
"platforms" : [
"iOS",
"Android"
],
"presets" : {
"iOS" : [
{
"title" : "iPhone 4S",
"width" : 320,
"height" : 480,
"scale" : 2
},
{
"title" : "iPhone 7",
"width" : 375,
"height" : 667,
"scale" : 2
}
],
"Android" : [
{
"title" : "ldpi",
"width" : 240,
"height" : 400
},
{
"title" : "mdpi",
"width" : 320,
"height" : 480
}
]
}
}
You can edit a presets file using the Presets Editor
or by editing the json file manually.
You can contribute presets in one of the following ways:
- Create an issue with your file: https://github.com/AnimaApp/Auto-Layout/issues
- Fork this repo
- Add your json file to the folder: https://github.com/AnimaApp/Auto-Layout/tree/master/presets/files
- Add a metadata entry of your file to the index: https://github.com/AnimaApp/Auto-Layout/blob/master/presets/index.json
- Create a Pull Request
- Email us your json file: presets@animaapp.com