Include a tweet in an article.
- Apple News Format
- Apple News API
tweet component lets users see social media content in an article.
On this page, you’ll learn how to use a tweet component to embed a tweet in an article.
Add a Tweet in Your Article
In Positioning Text Components, you created some
Component objects. You’ll refer to those
Component objects in this code.
Copy the example code Tweet: Copy This Code.
Paste the code inside in the
componentsarray of your article, after the last component and before the closing square bracket (
]) at the end of the array.
Your code should look like the example code Tweet: Result.
After you make this change in your code, you can preview your working
article file in News Preview to see a tweet in your article.
Tweet: Copy This Code
...) indicate lines of code that have been omitted from this example.
At any time, you can try changing property values in your
article file and then use News Preview to see how these changes affect the look of your article.
For example, try changing which tweet appears in your article:
articlefile, find the
Replace the value of the component’s
"https://twitter) with the URL to another tweet.
articlefile in News Preview.
The article now shows the tweet that you chose.