Skip to main content

Posts

Showing posts from March, 2018

Apple News Format API in Swift: GET Channel, Section and Article Data (Swift 4)

You can use the online tool to create your own Apple News posts through iCloud.com, no problem. You can also look to Apple's python scripts as a way to upload, download and delete articles. If it's a Swift equivalent you want, then you'll need to roll your own. And that's what I start to do here having covered a couple of side notes first.
Side notes about Python To use the Python scripts I needed to use easy_install to install requests on macOS.
Side notes on News Preview To use the News Preview app, and start exploring the Apple News Format, you need to have Java 8 installed, Xcode and Xcode command line tools, and a channel id (although Apple does provide a preview channel id in the readme file if you're not yet signed up to Apple News as a content provider).

Once you have everything installed grab the example articles and start learning.
Python: GET Channel Data This is the Python code that Apple provides in its documentation for returning channel data:
#!/usr…