shortcuts-swift icon indicating copy to clipboard operation
shortcuts-swift copied to clipboard

Actions for the "Tweet Current Song" shortcut

Open alexito4 opened this issue 6 years ago • 2 comments

~~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 .string in Aggrandizements to get title, artist, etc from a song.
  • tweet action
  • getCurrentSong action
  • getText action

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.

screen shot 2019-01-05 at 11 43 44

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.

alexito4 avatar Jan 05 '19 10:01 alexito4

This looks great! A couple of notes:

  1. Let's rebase your changes off of master
  2. Do we want to keep ShortcutsSwiftXcode.playground or should we move that into the Playground Book itself?

a2 avatar Jan 09 '19 16:01 a2

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 💃

alexito4 avatar Jan 12 '19 16:01 alexito4