Skip to content

Commit

Permalink
Change VisualEffect names to avoid conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
bingzheung committed Mar 4, 2024
1 parent 889a0ee commit b8b440b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions TypeDuck/Settings/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,23 @@ struct SettingsView: View {
} detail: {
switch selection {
case .candidates:
CandidatesView().visualEffect()
CandidatesView().applyVisualEffect()
case .help:
HelpView().visualEffect()
HelpView().applyVisualEffect()
case .about:
AboutView().visualEffect()
AboutView().applyVisualEffect()
}
}
} else {
NavigationView {
List {
NavigationLink(destination: CandidatesView().visualEffect(), isActive: $isCandidatesViewActive) {
NavigationLink(destination: CandidatesView().applyVisualEffect(), isActive: $isCandidatesViewActive) {
Label("SettingsView.NavigationTitle.Settings", systemImage: "list.number")
}
NavigationLink(destination: HelpView().visualEffect(), isActive: $isHelpViewActive) {
NavigationLink(destination: HelpView().applyVisualEffect(), isActive: $isHelpViewActive) {
Label("SettingsView.NavigationTitle.Help", systemImage: "keyboard")
}
NavigationLink(destination: AboutView().visualEffect(), isActive: $isAboutViewActive) {
NavigationLink(destination: AboutView().applyVisualEffect(), isActive: $isAboutViewActive) {
Label("SettingsView.NavigationTitle.About", systemImage: "info.circle")
}
}
Expand Down
8 changes: 4 additions & 4 deletions TypeDuck/VisualEffect.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import SwiftUI

struct VisualEffect: NSViewRepresentable {
struct VisualEffectView: NSViewRepresentable {
func makeNSView(context: Self.Context) -> NSView {
let view = NSVisualEffectView()
view.material = .sidebar
Expand All @@ -23,15 +23,15 @@ struct HUDVisualEffect: NSViewRepresentable {
}

extension View {
func visualEffect() -> some View {
return self.background(VisualEffect())
func applyVisualEffect() -> some View {
return self.background(VisualEffectView())
}
func hudVisualEffect() -> some View {
return self.background(HUDVisualEffect())
}
func roundedVisualEffect() -> some View {
return self.background(
VisualEffect()
VisualEffectView()
.cornerRadius(8)
.shadow(radius: 4)
)
Expand Down

0 comments on commit b8b440b

Please sign in to comment.