SwiftUI · State & Binding: Part 1 | raywenderlich.com


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/4001741-swiftui/lessons/22

Dear Isaac,
Thank you for your tutorial that I am following.
This short message to let you know that Box() does not exist anymore with XCode 11.1
Good continuation.
Jack

1 Like

Dear Isaac,
Please ignore the previous comment from my side.
I have just seen and realized that “Box” is a final class that you made in the project.
I was trying to use Box in my project thinking that it was coming from SwiftUI.
:frowning_face:
Good day…
Jack

Hey Jack, yeah its something we had to create to get the bindings working correctly as they seem to be still quite uncertain from time-to-time in some scenarios. L

Well noted Isaac,
In the BookDetailView if we click on the button the appearance does not change.
We have to go back to the ContentView and then come back to the BookDetailView to see the button appearance change.
Is there any way to see the Button appearance change inside the BookDetailView?
Thanks a lot again for this great Tutorial.
Jack

Oups! Sorry! The solution of my previous post is in the next chapter!

Hey - so this is another SwiftUI bug where we had to hide the preview from you until we completed the entire component as it only renders at the end for some reason. In previous versions of SwiftUI this wasn’t an issue, that’s why you have to get to the end of the 2nd part to see it! Sorry you had to wait so long to view the actual output - we spent hours trying to work around it and in the end this seemed like the best option.

Well done for finding this little issue! :-]

Hi. Is there a reason to use var instead of let for the Book property? I’m incline to use let. Thanks.

Hey @jfl111 - it might not be essential if its not mutated or a computed property. If let works then always go for a constant! :grin: Have a great day.

Hi Isaac,
I’ve been experimenting with SwiftUI based on your tutorial and Apple’s tutorials as well, using latest versions of everything, just want to ask you, have you noticed any poor performance? I run the companion materials in a physical device and for example the lists look very laggy, not even near to the performance it has a UICollectionView for example, is there any special switch on Swift’s compiler to make it run normal ( I mean without the lag ) or is that SwiftUI is slow on this version and perhaps in the future improves performance?

Thanks for any clues / comments,
Ivan

1 Like

Hey Ivan, I have noticed all sorts of small issues over the versions from beta to release. Hopefully things continue to improve as new versions are made available. There were some blissful times where I could render multiple previews simultaneously with instant update from Live Preview, to times where simply none of them would render at all! Hopefully you’re still enjoying the course though! Have a superb day.

Thanks Isaac,
This is still new technology where I see that performance needs to improve, we’ll see in next versions as you mention. The course is good helping out understanding SwiftUI in fastly fashion, thanks.
Have an excellent day as well!
Ivan.

1 Like

The preview isn’t working. I wonder if its due to the latest Xcode refresh (version 11.3.1). I went back to episode 19 and downloaded the materials and that preview works but not episode 22. I just get the busy indicator.

If I comment out line 43 of ContentView.swift it renders in the preview.

1 Like

I it finally rendered when I switched the device to iPhone 11 Pro Max simulator

2 Likes

Thanks @jerryp48 for figuring that out! I have no idea why its not working on individual simulators. Laurie.

Same situation, on Xcode Version 11.4.1.

The 11 Pro Max simulator the project works, but anything else I get just a blank white screen unless I comment out that line.

1 Like

@erikb42 Do you still have issues with this?

@isaacmendez Looks like Box final class wrapper is not longer needed. Please correct me if I am wrong. I am on Xcode 11.6 and just finished State & Binding: Part 2 | raywenderlich.com without using Box().

@niclego you can do it without a box wrapper now yes. This course was made when SwiftUI was still behind where it is now so there will be some small differences although mostly it is very consistent. Its good to know about the Box idea though! Have a great day! Laurie.

Xcode 12, swift 5.3, Catalina 10.15.7, simulator: iPhone 11 Pro Max

App startup screen is not rendering as in the video. It presents as
Screenshot 2020-10-14 at 09.50.39

Please help.