Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

SwiftUI – Initializer 'init(_:)' requires that 'Binding<Int>' conform to 'LosslessStringConvertible'

if(!user.hiddenUsersString.contains(String(meme.userid) + ",")){

}

I get

Initializer 'init(_:)' requires that 'Binding<Int>' conform to 'LosslessStringConvertible'

on String

what the hell is this? It worked without errors until yesterday.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Why is swift such a pile of garbage :/

>Solution :

You can’t pass a Binding to a String init. You need to pass the wrappedValue of the Binding instead.

String(meme.userid.wrappedValue)

This definitely couldn’t have worked in its current form until yesterday. You probably replaced the Int property with a Binding<Int> and that’s what introduced the issue.

Why is swift such a pile of garbage :/

It isn’t. You just made a mistake 🙂

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading