Adds the .help modifier to a variety of buttons

This commit is contained in:
Matt Kiazyk 2020-12-28 16:27:35 -06:00
parent e3f07e855e
commit fdb74ee8d9
No known key found for this signature in database
GPG key ID: 967DBC53389132D7
3 changed files with 14 additions and 1 deletions

View file

@ -34,8 +34,10 @@ struct InstallButton: View {
Button(action: uninstallOrInstall) {
if let xcode = xcode {
Text(xcode.installed == true ? "Uninstall" : "Install")
.help(xcode.installed == true ? "Uninstall" : "Install")
} else {
Text("Install")
.help("Install")
}
}
}
@ -58,6 +60,7 @@ struct SelectButton: View {
Button(action: select) {
Text("Select")
}
.help("Select")
}
private func select() {
@ -74,6 +77,7 @@ struct OpenButton: View {
Button(action: open) {
Text("Open")
}
.help("Open")
}
private func open() {
@ -90,6 +94,7 @@ struct RevealButton: View {
Button(action: reveal) {
Text("Reveal in Finder")
}
.help("Reveal in Finder")
}
private func reveal() {
@ -106,6 +111,7 @@ struct CopyPathButton: View {
Button(action: copyPath) {
Text("Copy Path")
}
.help("Copy Path")
}
private func copyPath() {

View file

@ -26,12 +26,14 @@ struct InspectorPane: View {
Image(systemName: "arrow.right.circle.fill")
}
.buttonStyle(PlainButtonStyle())
.help("Reveal in Finder")
}
HStack {
if xcode.selected {
Button("Selected", action: {})
.disabled(true)
.help("Selected")
} else {
SelectButton(xcode: xcode)
}
@ -80,6 +82,7 @@ struct InspectorPane: View {
}
.buttonStyle(LinkButtonStyle())
.frame(maxWidth: .infinity, alignment: .leading)
.help("View Release Notes")
} else {
EmptyView()
}

View file

@ -20,6 +20,7 @@ struct MainToolbarModifier: ViewModifier {
Label("Refresh", systemImage: "arrow.clockwise")
}
.keyboardShortcut(KeyEquivalent("r"))
.help("Refresh")
Button(action: {
switch category {
@ -35,7 +36,8 @@ struct MainToolbarModifier: ViewModifier {
.foregroundColor(.accentColor)
}
}
.help("Filter Installed Versions")
Button(action: { isShowingInfoPane.toggle() }) {
if isShowingInfoPane {
Label("Inspector", systemImage: "info.circle.fill")
@ -45,10 +47,12 @@ struct MainToolbarModifier: ViewModifier {
}
}
.keyboardShortcut(KeyboardShortcut("i", modifiers: [.command, .option]))
.help("Info Pane")
TextField("Search...", text: $searchText)
.textFieldStyle(RoundedBorderTextFieldStyle())
.frame(width: 200)
.help("Search List")
}
}
}