Merge pull request #32 from RobotsAndPencils/enhancement/31-helpModifier

Adds the .help modifier to a variety of buttons
This commit is contained in:
Matt Kiazyk 2020-12-30 15:48:54 -06:00 committed by GitHub
commit 2d419d5de6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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")
}
}
}
@ -59,6 +61,7 @@ struct SelectButton: View {
Text("Select")
}
.disabled(xcode?.selected != false)
.help("Select")
}
private func select() {
@ -75,6 +78,7 @@ struct OpenButton: View {
Button(action: open) {
Text("Open")
}
.help("Open")
}
private func open() {
@ -91,6 +95,7 @@ struct RevealButton: View {
Button(action: reveal) {
Text("Reveal in Finder")
}
.help("Reveal in Finder")
}
private func reveal() {
@ -107,6 +112,7 @@ struct CopyPathButton: View {
Button(action: copyPath) {
Text("Copy Path")
}
.help("Copy path")
}
private func copyPath() {

View file

@ -27,12 +27,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)
}
@ -81,6 +83,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("Show or hide the info pane")
TextField("Search...", text: $searchText)
.textFieldStyle(RoundedBorderTextFieldStyle())
.frame(width: 200)
.help("Search list")
}
}
}