Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/a2/shortcuts-swift
Write Shortcuts in Playgrounds
https://github.com/a2/shortcuts-swift
ios ios-12 playground-book shortcuts workflow
Last synced: 4 months ago
JSON representation
Write Shortcuts in Playgrounds
- Host: GitHub
- URL: https://github.com/a2/shortcuts-swift
- Owner: a2
- License: mit
- Archived: true
- Created: 2018-12-23T13:36:05.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-07-03T20:37:18.000Z (over 4 years ago)
- Last Synced: 2024-05-02T00:54:21.674Z (7 months ago)
- Topics: ios, ios-12, playground-book, shortcuts, workflow
- Language: Swift
- Homepage: https://github.com/a2/shortcuts-swift
- Size: 1.12 MB
- Stars: 131
- Watchers: 7
- Forks: 11
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
*This repository has been replaced with [SwiftShortcuts](https://github.com/a2/swift-shortcuts), and is archived for reference.*
![Banner](https://raw.githubusercontent.com/a2/shortcuts-swift/master/banner.png)
# Shortcuts Swift
[![Build Status](https://dev.azure.com/pandamonia/shortcuts-swift/_apis/build/status/a2.shortcuts-swift?branchName=master)](https://dev.azure.com/pandamonia/shortcuts-swift/_build/latest?definitionId=3?branchName=master)
[Subscription feed link](https://raw.githubusercontent.com/a2/shortcuts-swift/master/feed.json) or click [here](https://developer.apple.com/ul/sp0?url=https://raw.githubusercontent.com/a2/shortcuts-swift/master/feed.json) on your iPad with Swift Playgrounds 2 installed.
## Example
### Warn for Low Battery Level
```swift
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
```swift
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```swift
.package(url: "https://github.com/a2/shortcuts-swift", from: "1.0.0")
```## Contributing
Please read the [Contributions Guide](CONTRIBUTING.md) and the [Code of Conduct](CODE_OF_CONDUCT.md) before getting started. You will need Xcode 10 or newer to build the project.
## Authors
[Alexsander Akers](https://github.com/a2) and [Alexis Aubry](https://github.com/alexaubry)
## License
Shortcuts Swift is available under the MIT license. See the LICENSE file for more info.