Project Suggestion from @devahmedshendy
- Lingua principale
- Swift
- Stelle
- 4
- Fork
- 1
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
## Suggested by [devahmedshendy](https://github.com/devahmedshendy)
## [Initial Pitch](https://github.com/0xLeif/RobotKit/issues/5)
As per our discussion, I like to share my thoughts about "Why not implement a declarative interface for RobotKit?"
When I saw [Robot Example](https://github.com/devahmedshendy/RobotKit#robot-example) from README.md, I thought in 2022, it would be better if we provide a declarative interface for this library.
I think we should have another library (let's call it *SwiftRobot*), that will be an abstraction layer above **RobotKit**, that will provide a declarative interface to perform tasks as a description than just a discrete commands.
Let's say we want to implement the following task:
- Type "Hello World!" at the center of the screen
- Take a screenshot for the whole screen
- Extract text from that screenshot
- Send notification to the user that all are done
- make sound that reflect success or failure of whole task
Getting inspired by SwiftUI, I thought there would be a protocol called **RobotTask** (to distinguish it from the Task of Swift language)
```swift
protocol RobotTask {
var work: RobotTask // I still don't understand the use/value of Opaque type, so maybe we should use it here.
}
```
Then something like the following will be how to make a task in declarative way:
```swift
keyword HelloWorldTask: RobotTask {
var work: RobotTask {
SequenceGroup {
Type("Hello World")
Screenshot(.wholeScreen)
.extractText()
Notify(.success, "Mission Accomplished")
.enableSounds()
}
}
}
```
*HelloWorldTask*, *SequenceGroup*, *Type*, *Screenshot*, *Notify*, they all will be of type *RobotTask*, and each will have some work to do.
Of course for every declarative there is definitely some imperative approach behind the scenes, which of course will be the **RobotKit** library itself as a dependency (I know SwiftUI doesn't specifically use UIKit behind the scene, but RobotKit contains the low-level of executions needed so far).
Maybe this implementation doesn't fit the declarative approach for **RobotKit**, but I just wanted to open an issue and kickstart these thoughts.
We don't have to go rush for this, we just manage and prioritize tasks.
Btw, I would suggest if you create new repo not me because I want your lead for this beginning journey for me as a contributor in such kind of projects.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.