Rename launch to open

This is the preferred verb when it's user-facing, according to Apple's style guide.
This commit is contained in:
Brandon Evans 2020-12-28 09:27:07 -07:00
parent 3f76fb9e36
commit 9dc3d21f2e
No known key found for this signature in database
GPG key ID: D58A4B8DB64F8E93
4 changed files with 11 additions and 11 deletions

View file

@ -237,7 +237,7 @@ class AppState: ObservableObject {
)
}
func launch(id: Xcode.ID) {
func open(id: Xcode.ID) {
guard let installedXcode = Current.files.installedXcodes(Path.root/"Applications").first(where: { $0.version == id }) else { return }
NSWorkspace.shared.openApplication(at: installedXcode.path.url, configuration: .init())
}

View file

@ -14,7 +14,7 @@ struct XcodeCommands: Commands {
Divider()
SelectCommand()
LaunchCommand()
OpenCommand()
RevealCommand()
CopyPathCommand()
}
@ -66,19 +66,19 @@ struct SelectButton: View {
}
}
struct LaunchButton: View {
struct OpenButton: View {
@EnvironmentObject var appState: AppState
let xcode: Xcode?
var body: some View {
Button(action: launch) {
Text("Launch")
Button(action: open) {
Text("Open")
}
}
private func launch() {
private func open() {
guard let xcode = xcode else { return }
appState.launch(id: xcode.id)
appState.open(id: xcode.id)
}
}
@ -138,12 +138,12 @@ struct SelectCommand: View {
}
}
struct LaunchCommand: View {
struct OpenCommand: View {
@EnvironmentObject var appState: AppState
@FocusedValue(\.selectedXcode) private var selectedXcode: SelectedXcode?
var body: some View {
LaunchButton(xcode: selectedXcode.unwrapped)
OpenButton(xcode: selectedXcode.unwrapped)
.keyboardShortcut(KeyboardShortcut(.downArrow, modifiers: .command))
.disabled(selectedXcode.unwrapped?.installed != true)
}

View file

@ -36,7 +36,7 @@ struct InspectorPane: View {
SelectButton(xcode: xcode)
}
LaunchButton(xcode: xcode)
OpenButton(xcode: xcode)
}
} else {
InstallButton(xcode: xcode)

View file

@ -76,7 +76,7 @@ struct XcodeListView: View {
if xcode.installed {
SelectButton(xcode: xcode)
LaunchButton(xcode: xcode)
OpenButton(xcode: xcode)
RevealButton(xcode: xcode)
CopyPathButton(xcode: xcode)
}