|
Hi All, I am creating a simple app that manages User detail, but seeing this: I am reasonable new to Swift/SwiftUI after coming across from ObjecticeC. It's a pretty steep learning curve :-) I hope the following will show you what I am trying to do. The code below is from a seperate .Swift file:
I am not sure if this is the correct format, but please comment as needed. This is how I'm declaring in the View:
And this is how I'm trying to use it. InputField is a custom TextField.
Now at this point, I see the error message. How do I get around this? Fritzables |
|
Hi I know that you have come from ObjecticeC(🤯) but like any langauge start from the begining. Look at excellent course of 100 days of SwiftUI as Swift/SwiftUI are different from ObjecticeC. Plus you will see how to use the new |
|
Hey NigelGee, This is how I have created the InputField.
Not sure if this shines light on it. From what you have said, I should be seperating out each Property (ie: FirstName, LastName,...) and @Publish them seperately?? Pete PS: Yea, I only found this site last night and I was allready in the deep-end. :-) |
|
OK thought that the case
this is rough so you can get an idea
Change the
The
The
Remember to put the
}
Now in
If you run in a Test/Sandbox project and have a play with it there. Hope that some help. |
|
Nice work NigelGee, Thats awsome. should keep me out of trouble for a while. Much appreciated Nigel. Pete |
|
I have been thinking about the
Which now mean you can use in
or in
|
|
The error message you're encountering, "Cannot convert value of type 'Published<[String]>.Publisher' to expected argument type 'Binding<String>'", suggests that there's a type mismatch between the To resolve this, you need to ensure that Here's how you can adjust your
And then, adjust your usage of
By making these changes, you'll be able to bind individual string properties from your |
SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.
Sponsor Hacking with Swift and reach the world's largest Swift community!
You need to create an account or log in to reply.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.