Swiftpack.co - Package - a2/shortcuts-swift

Banner

Shortcuts Swift

Build Status

Subscription feed link or click here on your iPad with Swift Playgrounds 2 installed.

Example

Warn for Low Battery Level

let batteryLevel = actionOutput()
let shortcut = buildShortcut(
    comment("This Shortcut was generated in Swift.") +
    getBatteryLevel().savingOutput(to: batteryLevel) +
    ifLessThan(20, ifTrue: (
        setLowPowerMode(true) +
        showResult("Your battery is at \(batteryLevel)%, you might want to charge it.")
    ), ifFalse: (
        showResult("Your battery is at \(batteryLevel)%, you're probably fine for now.")
    ))
)

Clap Along

let shortcut = buildShortcut(
    comment("This Shortcut was generated in Swift.") +
    ask(question: "WHAT 👏 DO 👏 YOU 👏 WANT 👏 TO 👏 SAY") +
    changeCase(to: .uppercase) +
    replaceText("[\\s]", replaceWith: " 👏 ", regularExpression: true) +
    chooseFromMenu(items: [
        ("Share", share()),
        ("Copy to Clipboard", copyToClipboard()),
    ])
)

Swift Package Manager

.package(url: "https://github.com/a2/shortcuts-swift", from: "1.0.0")

Contributing

Please read the Contributions Guide and the Code of Conduct before getting started. You will need Xcode 10 or newer to build the project.

Authors

Alexsander Akers and Alexis Aubry

License

Shortcuts Swift is available under the MIT license. See the LICENSE file for more info.

Github

link
Stars: 95
Help us keep the lights on

Dependencies

Used By

Total: 0

Releases

1.0 - Dec 23, 2018

SHA512: 9daf5f0eeb901e0512060c89dc799e13309a3be52ab26801ba051da45e9e011871880b0efb52426f68c9083eb0a3c6e96306ef488ebcf77556c77b6c56a96b65