twostraws / ControlRoom

A macOS app to control the Xcode Simulator.
MIT License
5.77k stars 304 forks source link

Expressive API for communicating with simctl #49

Closed pluddy closed 4 years ago

pluddy commented 4 years ago

Mostly adding this because it's something I want to take a stab at!

The goal would be to take something like our current:

execute(["status_bar", simulator, "override", "--batteryLevel", "\(level)", "--batteryState", "charging"])

and turn it into something like:

execute(.statusBar(deviceId: simulator, operation: .override([.batteryLevel(level), .batteryState(.charging)])))

Hoping this will also simplify some of the iterating cases in the ui, turning for example:

let resetPermissions = [
    "All",
    "Calendar",
    "Contacts",
    "Location",
    "Microphone",
    "Motion",
    "Photos",
    "Reminders",
    "Siri"
 ]

Picker("Permissions:", selection: $resetPermission) {
    ForEach(resetPermissions, id: \.self) {
        Text($0)
    }
}

into:

Picker("Permissions:", selection: $resetPermission) {
    ForEach(SimCtl.Privacy.Permission.allCases, id: \.self) {
        Text($0.displayName)
    }
}
davedelong commented 4 years ago

👏 YES. This is on my mental list of things I'd like to see improved. Please go for it!

pluddy commented 4 years ago

First stab in #53, please leave input there!