Oddbean new post about | logout

Notes by Chris Eidhof | export

 nostr:npub1sy8vt0hed8vr58ueqjlvmpzylv9he2fvv04luf4z5vyzsuut5zvqfpw2zc Ok! I really liked having t... 
 @827db45f yes, we realized... you're not the only one to ask for this. Unfortunately, we don't have a quick way of doing this currently, but hopefully some time in the future. 
 nostr:npub1sy8vt0hed8vr58ueqjlvmpzylv9he2fvv04luf4z5vyzsuut5zvqfpw2zc I was wondering if there is... 
 @827db45f currently not. It’s something we are looking into. 
 nostr:npub1sy8vt0hed8vr58ueqjlvmpzylv9he2fvv04luf4z5vyzsuut5zvqfpw2zc Hey Chris, I'll probably ha... 
 @dbc45806 the lifecycle of the coordinator is tied to the lifecycle of the swiftui view (and so is the uiview). Setting parent copies all the properties from the swiftui view to the coordinator, as these might have changed. 
 nostr:npub1ty75fg59pcgxmd9x3yyggf5acy6zsrvvxvppykmqe76vvvm7qtlqslz330 Are team licenses no longer... 
 @21e35345 @593d44a2 we removed those during the beta, should be added back in a minute or so! 
 I can date myself by admitting that Death Cab’s “Photo Album” is still “the new album tha... 
 @cbccdfde haha, nice. My moment like that is with Transatlanticism. I saw them live a few times, the first time was in 2006 (I think) in Amsterdam. I think they even played the smaller hall. So many good memories. 
 nostr:npub1sy8vt0hed8vr58ueqjlvmpzylv9he2fvv04luf4z5vyzsuut5zvqfpw2zc I love this article, this i... 
 @cbc7111e yes, that might be a good idea. Do you happen to have a concrete example where things would break? 
 nostr:npub1sy8vt0hed8vr58ueqjlvmpzylv9he2fvv04luf4z5vyzsuut5zvqfpw2zc Phew. That's good to know! ... 
 @d432c4d9 it’s not that hard, just a few log statements! 
 I updated the view representable blog post to better explain what happens when multiple events are enqueued (e.g. in the text editor case). Now with diagrams as well! https://chris.eidhof.nl/post/view-representable/ 
 Thanks to @d432c4d9 for suggesting this potential problem. 
 @d432c4d9 I think in theory, the bindings might change. So in updateView I *think* you need to at least set them (that's what I do with the parent setting). I'm not 100% sure though. 
 @d432c4d9 okay, just verified. If you run the following Mac app you'll see different behavior when you comment out line 34: https://gist.github.com/chriseidhof/05296abae6a54cc737d25497a6060405#file-textview-swift-L34 
 @d432c4d9 I think in theory, the bindings might change. So in updateView I *think* you need to at least set them (that's what I do with the parent setting). I'm not 100% sure though. 
 nostr:npub1sy8vt0hed8vr58ueqjlvmpzylv9he2fvv04luf4z5vyzsuut5zvqfpw2zc Thanks for sharing! I playe... 
 @d432c4d9 so after thinking more about this (and experimenting) it turns out that these updates are actually not spaced out. They all get enqueued straight after each other, and the view is only re-rendered after they're all processed. I updated the post. Thanks for suggesting this! 
 nostr:npub1sy8vt0hed8vr58ueqjlvmpzylv9he2fvv04luf4z5vyzsuut5zvqfpw2zc nostr:npub1k4uen3un4w2htkje... 
 @fc1ad892 @b57999c7 maybe! Do you have a more concrete example (code) you could show? If yes I can try to research! 
 nostr:npub1sy8vt0hed8vr58ueqjlvmpzylv9he2fvv04luf4z5vyzsuut5zvqfpw2zc nice! Will look at this a b... 
 @dbc45806 thanks! Let me know if you find anything missing/wrong. 
 I wrote a new article about UIViewRepresentable. I came up with two rules for working with them: make all updates from UIKit -> SwiftUI async, and only update what's really needed when setting UIKit properties. If anyone has more feedback I'd love to hear it. https://chris.eidhof.nl/post/view-representable/ 
 nostr:npub1sy8vt0hed8vr58ueqjlvmpzylv9he2fvv04luf4z5vyzsuut5zvqfpw2zc One use case that seems to ... 
 @3f3a1a5f interesting. Do you know of any example view controllers that work like that? 
 nostr:npub1sy8vt0hed8vr58ueqjlvmpzylv9he2fvv04luf4z5vyzsuut5zvqfpw2zc Good good, let's go for a s... 
 @0c13b2e9 so many lakes to choose from! 
 nostr:npub1sy8vt0hed8vr58ueqjlvmpzylv9he2fvv04luf4z5vyzsuut5zvqfpw2zc Triathlon incoming? 
 @45cfa922 no, I just like swimming for fun, not competitive. 
 nostr:npub1sy8vt0hed8vr58ueqjlvmpzylv9he2fvv04luf4z5vyzsuut5zvqfpw2zc 🤯 
 @7fe91a4d you can also use that technique to pass the view value to the coordinator. 
 If anyone has questions for today's SwiftUI Q&A let us know here: https://github.com/objcio/thinking-in-swiftui-qa/issues. Currently we only have one open question for tonight. 
 nostr:npub1sy8vt0hed8vr58ueqjlvmpzylv9he2fvv04luf4z5vyzsuut5zvqfpw2zc I never found a way of modi... 
 @7fe91a4d do you have an example? Is this like (say) a text view that you always want to apply a SwiftUI padding to? 
 @7fe91a4d interesting. I think I would solve it something like this, not sure if this covers all the cases: https://gist.github.com/chriseidhof/cac0515afe0ba0c561f85f6c0f12786b 
 @0c13b2e9 I have one of those and used it, great tip! I don’t think I’d have swam across without the buoy. I mean, if I had had others swim or paddle with me I don’t think I would have been so anxious. 
 nostr:npub1sy8vt0hed8vr58ueqjlvmpzylv9he2fvv04luf4z5vyzsuut5zvqfpw2zc I know you’re using a cor... 
 @284bffec haha! Well I just ordered a new strap. 
 We live very close to the lake, and today I finally dared to swim across (alone). I managed not to panic but almost did lose my watch (had to change from freestyle to breaststroke once it got loose). In the end, it took less than ten minutes to swim the 450m or so. My goal for next year is to do this while staying relaxed 😅.

https://objc.s3proxy.de/media_attachments/files/111/024/801/373/662/523/original/e39a00dfa641bb97.png 
 nostr:npub1sy8vt0hed8vr58ueqjlvmpzylv9he2fvv04luf4z5vyzsuut5zvqfpw2zc Oh boy, yes please! I've ha... 
 @dbc45806 yes! Do you happen to have some concrete samples of views you’d like to wrap where these problems apply? 
 My next goal for understanding SwiftUI is to *really* understand UIViewRepresentable. If you have examples of stuff you can't get to work, I'd love to hear about it. I'm trying to come up with some rules and patterns so that we don't have to have all kinds of ad-hoc weird hacks to make representables work. I will write this up once I have the feeling I understand it well enough :) 
Event not found
 @d432c4d9 solid!