-
Notifications
You must be signed in to change notification settings - Fork 11
Actions for the "Tweet Current Song" shortcut #20
base: master
Are you sure you want to change the base?
Conversation
@@ -1,6 +1,6 @@ | |||
import Foundation | |||
|
|||
public func withInterpolatedText(_ string: String) -> Any { | |||
func withInterpolatedText(_ string: String) -> Any { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made this public for a bit to facilitate the creation of Actions in the playground itself, which is easier than doing it in the framework files.
@@ -39,12 +39,16 @@ public func exportShortcut(_ actionContainer: ActionContainer) -> Data { | |||
return try! PropertyListSerialization.data(fromPropertyList: buildShortcut(actionContainer), format: .binary, options: 0) | |||
} | |||
|
|||
public func exportShortcut(_ shortcut: PropertyList) -> Data { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes it easier to save the shortcut on the mac and send it to the phone for testing.
} | ||
save(ext: "shortcut") | ||
// TESTING | ||
save(ext: "plist") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like to save a plist version of the shortcut to be able to open it and compare it with the original.
This looks great! A couple of notes:
|
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 💃 |
Branches from #19To get familiar with the library I tried to replicate the "Tweet Current Song" shortcut:
To acomplish this I had to:
.string
inAggrandizements
to get title, artist, etc from a song.tweet
actiongetCurrentSong
actiongetText
actionWith this I was able to replicate the shortcut with the following code:
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.