Preferences dialog wont work no matter what i do #77

Open
opened 2025-12-26 16:54:57 +01:00 by Travelller1616 · 2 comments

Describe the bug

Preferences dialog always throws a Value of type 'any AnyView' has no member 'preferencesDialog'

To Reproduce

Here is a snippet of my code im trying to use it like the aboutDialog

struct ToolbarView: View {
    @State private var about = false
    @State private var shortcuts = false
    @State private var loginDialogIsVisible = false
    @State private var searchText = ""
    @State private var searchVisible = false
    @State private var selectedView: AppView = .discover
    @State private var searchModeEnabled = false
    @State private var discoverSection = true
    @State private var prefrencesDialogIsVisible = false

    var app: AdwaitaApp
    var window: AdwaitaWindow
    let css = """
    .transparent-header {
        background-color: transparent !important;
        background-image: none !important;
        border-color: transparent !important;
        box-shadow: none !important;
        --headerbar-bg-color: transparent !important;
    }
    """
    var view: Body {

            
        
        VStack {
            HeaderBar()
            
                
             
                .end {
                    if searchVisible {
                        SearchEntry()
                            .stopSearch {
                                searchVisible = false
                            }
                    } else {
                        Button(icon: .default(icon: .systemSearch)) {
                            searchVisible = true
                        }
                        .raised()
                    }
                
                    content
                  }
                
                
                
                .style("transparent-header")
                
        
            
            

        }
        
        .style("transparent-header")
        
        .overlay {
            HStack {
                Button(icon: .default(icon: .systemSearch)) {
                    discoverSection = true
                    
                }
                .raised(discoverSection)
                .flat(!discoverSection)

         
                Button(icon: .default(icon: .systemFileManager)) {
                    discoverSection = false
                }
                .flat(discoverSection)
                .raised(!discoverSection)
                
            }
            .style("my-custom-class")
            .halign(.center)
            .valign(.start)
            .hexpand(true)
            .vexpand(true)
            .css {
                """
                .my-custom-class {
                    background-color: #2E2E32;
                    backdrop-filter: blur(10px);
                    border-radius: 10px;
                    transform: scale(1.3);
                    margin-top: 15px;
                    padding: 2px;
                }
                """
            }
        }
    
            
            .aboutDialog(
                visible: $about,
                app: "AdwaitaTemplate",
                developer: "david-swift",
                version: "dev",
                icon: .custom(name: "io.github.AparokshaUI.AdwaitaTemplate"),
                website: .init(string: "https://git.aparoksha.dev/aparoksha/adwaita-template")!,
                issues: .init(string: "https://git.aparoksha.dev/aparoksha/adwaita-template/issues")!
            )
            .dialog(visible: $loginDialogIsVisible, title: "Login to Stremio", id: "login") {
                DialogView(visible: $loginDialogIsVisible)
            }
            .preferencesDialog(visible: $prefrencesDialogIsVisible, id: "prefs") {
                
            }
            
            
    }

Expected behavior

No response

Additional context

No response

### Describe the bug Preferences dialog always throws a Value of type 'any AnyView' has no member 'preferencesDialog' ### To Reproduce Here is a snippet of my code im trying to use it like the aboutDialog ``` struct ToolbarView: View { @State private var about = false @State private var shortcuts = false @State private var loginDialogIsVisible = false @State private var searchText = "" @State private var searchVisible = false @State private var selectedView: AppView = .discover @State private var searchModeEnabled = false @State private var discoverSection = true @State private var prefrencesDialogIsVisible = false var app: AdwaitaApp var window: AdwaitaWindow let css = """ .transparent-header { background-color: transparent !important; background-image: none !important; border-color: transparent !important; box-shadow: none !important; --headerbar-bg-color: transparent !important; } """ var view: Body { VStack { HeaderBar() .end { if searchVisible { SearchEntry() .stopSearch { searchVisible = false } } else { Button(icon: .default(icon: .systemSearch)) { searchVisible = true } .raised() } content } .style("transparent-header") } .style("transparent-header") .overlay { HStack { Button(icon: .default(icon: .systemSearch)) { discoverSection = true } .raised(discoverSection) .flat(!discoverSection) Button(icon: .default(icon: .systemFileManager)) { discoverSection = false } .flat(discoverSection) .raised(!discoverSection) } .style("my-custom-class") .halign(.center) .valign(.start) .hexpand(true) .vexpand(true) .css { """ .my-custom-class { background-color: #2E2E32; backdrop-filter: blur(10px); border-radius: 10px; transform: scale(1.3); margin-top: 15px; padding: 2px; } """ } } .aboutDialog( visible: $about, app: "AdwaitaTemplate", developer: "david-swift", version: "dev", icon: .custom(name: "io.github.AparokshaUI.AdwaitaTemplate"), website: .init(string: "https://git.aparoksha.dev/aparoksha/adwaita-template")!, issues: .init(string: "https://git.aparoksha.dev/aparoksha/adwaita-template/issues")! ) .dialog(visible: $loginDialogIsVisible, title: "Login to Stremio", id: "login") { DialogView(visible: $loginDialogIsVisible) } .preferencesDialog(visible: $prefrencesDialogIsVisible, id: "prefs") { } } ``` ### Expected behavior _No response_ ### Additional context _No response_
Travelller1616 added the
bug
label 2025-12-26 16:54:57 +01:00
Owner

This should actually work. Is the dependency in your Package.swift file referencing the main branch or the 0.1.0 release? I recommend the main branch until I release the next version (preferences dialogs were added after this release).

This should actually work. Is the dependency in your `Package.swift` file referencing the `main` branch or the `0.1.0` release? I recommend the main branch until I release the next version (preferences dialogs were added after this release).
Author

@david-swift that fix worked but the preferences group styling wont apply when displaying actionRows with ForEach

@david-swift that fix worked but the preferences group styling wont apply when displaying actionRows with ForEach
Sign in to join this conversation.
No Milestone
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: aparoksha/adwaita-swift#77
No description provided.