Skip to content

Instantly share code, notes, and snippets.

@sketchytech
Last active March 24, 2016 10:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sketchytech/6c5ff4be95b2f0ef70ab to your computer and use it in GitHub Desktop.
Save sketchytech/6c5ff4be95b2f0ef70ab to your computer and use it in GitHub Desktop.
Apple News Format: Adding Component Text Styles
{
"version": "1.1",
"identifier": "sketchyTech_Demo",
"title": "My First Article",
"language": "en",
"layout": {},
"components": [
{
"role": "title",
"text": "My First Article",
"textStyle": "titleStyle"
},
{
"role": "body",
"text": "This is just over the minimum amount of JSON required to create a valid article in Apple News Format. If you were to delete the dictionary enclosing this text, you'd be there.",
"textStyle": "bodyStyle"
}
],
"componentTextStyles": {
"titleStyle": {
"textAlignment": "center",
"fontName": "HelveticaNeue-Bold",
"fontSize": 64,
"lineHeight": 74,
"textColor": "#000"
},
"bodyStyle": {
"textAlignment": "left",
"fontName": "Georgia",
"fontSize": 18,
"lineHeight": 26,
"textColor": "#000"
}
}
}
@sketchytech
Copy link
Author

Once you have the basic structure of an Apple News Format article you can add text styles by first referencing them with a textStyle key inside a component and then adding a componentTextStyle of the same name to the componentTextStyles dictionary. Think of component text styles as paragraph styles for your text, they can be reused time and again.

Note: The fonts you employ can be chosen from the entire list of iOS fonts. Although it is possible to include custom fonts there don't appear to be any guidelines on whether you should.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment