|
Good morning Doing a little macOS app to generate posting barcode labels....where it takes inputs from textfields and generates the required GET method URL string like:
This works fine...but as soon I want to use variables inside the string with (name) and so on...the URL isn't even called...nor a warning/error is thrown.... Is there a better way to load images via URL GET method? Downside of AsyncImage is that I can't force a refresh with a button in the same view.... thanks in advance richard |
|
|
|
This is the AsyncImage part:
|
|
So basic debugging technique. Did you try creating a standalone string and populating the URL with this string?
|
|
Good morning (o; My fault.....forgot about URL encoding (o; Using this function now to supply the URL string:
Only annoying is that for every key press in a TextField AsyncImage is called....have to think about another solution to only show AsyncImage on demand.... |
|
Richard is annoyed and maps a path for learning a new technique:
Are ye familiar with No? Hang on tight, this is your opportunity to learn from another brilliant SwiftUI developer! Debouncing is the process of accepting user input from a TextField, then executing some code. The debounce technique, however, only executes the code after a predetermined delay from the last time it executed the code. So, if your user is entering the city Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch into the Come back and let us know how you implemented your solution! See-> Debouncing User Input <- The other brilliant developer. (Not me!!) See-> Visit Beautiful Wales |
|
Never said I was annoyed ;-) Okay..just watched the video...and seems "debounce" is the way to go.... One drawback though with AsyncImage: Loading a new image doesn't show ProgressView() anymore in phase .empty when an image has been loaded before...as it isn't "empty" anymore of course (o; Is there a way to clear the loaded image? |
|
Did you edit your post? I am almost quite sure that I quoted you directly:
|
SAVE 50% To celebrate WWDC22, all our books and bundles are half price, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.
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.