shortcuts-swift
shortcuts-swift copied to clipboard
Actions for the "Tweet Current Song" shortcut
~~Branches from #19~~
To get familiar with the library I tried to replicate the "Tweet Current Song" shortcut:
To acomplish this I had to:
- Added an Xcode playground to develop on the Mac.
- case
.stringinAggrandizementsto get title, artist, etc from a song. tweetactiongetCurrentSongactiongetTextaction
With this I was able to replicate the shortcut with the following code:
+ getCurrentSong().savingOutput(to: song)
+ getText("Listening to \(title) by \(artist) using Swift!").savingOutput(to: tweetText)
+ list(["\(tweetText)", "\(albumArtwork)"])
+ tweet()
The plist is the same as the one created by the App except the content of the list action.
The implementation of the list action assumes [String] but seems like the app supports different types. It works with this example but we may want to look into it to make other uses posible.
This looks great! A couple of notes:
- Let's rebase your changes off of master
- Do we want to keep ShortcutsSwiftXcode.playground or should we move that into the Playground Book itself?
The changes have been rebased 🎉
In terms of the playgrounds, that's up to you. I personally like to have the Xcode playground to work from the Mac, specially since currently I don't have my iPad with me. The actions should already be available on the Playground Book (but I haven't been able to try that). I can move it an give it a try when I have the iPad 👍
But are you happy keeping the Xcode playground to facilitate development of actions from the Mac?
And what's the vision with the book? You want to keep adding pages demonstrating new actions?
Cheers 💃