UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

Trying to figure out Conflicting arguments to generic parameter 'Content' ('<<hole>>' vs. '<<hole>>' vs. '<<h

Forums > SwiftUI

When you click on the little 2 to the left of the message, what does the expanded error show? Does it give you a fix-it?

Also, what happens if you change this:

private var allBases: [Locations] = Locations.allBases
var filteredLocations: [Locations] {
    if searchText.isEmpty() {
        return allBases
    } else {
        return allBases.filter { $0.name.localizedCaseInsensitiveContains(searchText) }
    }
}

to this:

var filteredLocations: [Locations] {
    if searchText.isEmpty {
        return Locations.allBases
    } else {
        return Locations.allBases.filter { $0.name.localizedCaseInsensitiveContains(searchText) }
    }
}

1      

Had to remove () from .isEmpty, other than that same errors.

Oops, yeah, sorry 'bout that.

But you can't be getting the same errors because with my change you no longer have a the private var allBases property and thus can't be getting the error about "HomeView initializer is inaccessible due to 'private' protection level."

If you absolutely have to have that allBases property in there, change it from var to let since it doesn't actually change anywhere. That, at least, should get rid of that one error, and maybe even more.

HomeView -> when I get rid of weather: on line 30, all the errors go away but it says "Missing argument for parameter 'weather' in call"

Right, because HomeView is expecting a weather property to be passed in.

Something else you can try: Take out the VStack in your HomeView; there's no need for it. I mean, I doubt that's it, but you never know.

1      

What specifically fixed the Conflicting arguments error? I am having the same error when I am also trying to use List() Navlink with my custom struct

   

BUILD THE ULTIMATE PORTFOLIO APP Most Swift tutorials help you solve one specific problem, but in my Ultimate Portfolio App series I show you how to get all the best practices into a single app: architecture, testing, performance, accessibility, localization, project organization, and so much more, all while building a SwiftUI app that works on iOS, macOS and watchOS.

Get it on Hacking with Swift+

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.