Questions tagged [swiftui-asyncimage]

28 questions
0
votes
1 answer

AsyncImage with a placeholder sizing to fit to aspect ratio and clipping

I'm trying to create an AsyncImage with a placeholder image. With the following constraints... The placeholder image may not have the same aspect ratio as the AsyncImage. The remote image may not have the same aspect ratio as the AsyncImage. The…
Fogmeister
  • 76,236
  • 42
  • 207
  • 306
0
votes
1 answer

Error message: "Type 'any ViewModifier' cannot conform to 'ViewModifier'"

At the moment I try to create a package with SwiftUI. I created a ProfileImageView. I get an Url as an optional String, which I convert to a non-optional String with if...let... In the body I use this String for an AsyncImage. The AsyncImage just…
0
votes
1 answer

How can I implement a "Drag to resize" for an image in SwiftUI?

Consider having a screen like on the wireframe consisting of text, an image, and a sheet. When the sheet is dragged down, the image should grow vertically and go out of bounds. This already works to a certain extent, but the image only scales…
ammerzon
  • 998
  • 1
  • 13
  • 30
0
votes
1 answer

How do I show an AsyncImage only after its downloaded?

I am using AsyncImage to load remote images, once a certain condition is met ('ready' in the example), meanwhile I show a default placeholder image. The problem I have is that while the remote image starts to download (when the condition is met),…
Ori C.
  • 61
  • 7
0
votes
0 answers

How to properly center and set aspect ratio for an image in SwiftUI?

I've been trying like a million different ways in terms of modifier order but I just don't seem to get the centering of the image correct, this is what my struct looks like struct RecipeDetailView: View { let recipe: Recipe var body: some View { …
0
votes
1 answer

SwiftUI AsyncImage ProgressView deadline

How can I achieve such a scenario. Using the AsyncImage I load the url. Progress view turns around as placeholder After 2 seconds we don't get an error Our ProgressView changes to an image This is a code: AsyncImage(url: exampleURL) { phase in …
miltenkot
  • 29
  • 4
0
votes
1 answer

Moving to details view with Image in SwiftUI

I am new to swift. I am trying to achieve the requirement is when the spacific view record is selected I am want to move into details view with selected record including image. But the problems is the text property is display as expected not image…
Nus
  • 35
  • 5
0
votes
2 answers

AsyncImage in List is broken on iOS 16

struct Item: Identifiable { let id: String let url = URL(string: "https://styles.redditmedia.com/t5_j6lc8/styles/communityIcon_9uopq0bazux01.jpg")! } struct Content: View { let model: [Item] = { var model = [Item]() for…
klememi
  • 96
  • 1
  • 6
0
votes
0 answers

Where/How to put an image on the internet so it can be pulled via Swift?

So I want to just pass in an image https://... url into AsyncImage but for the life of me, I can't figure out how to upload this image to the internet so that it can be pulled into the swift code. Any suggestions on free ways to upload the image…
nickcoding2
  • 142
  • 1
  • 8
  • 34
0
votes
1 answer

AsyncImage. Cannot use switch statement in Phase closure?

When I use switch statement in phase in asyncImage it gave me this error. Trailing closure passed to parameter of type 'CGFloat' that does not accept a closure I understand that docs uses if let statements to extract the image and get the error…
Usefz89
  • 53
  • 5
0
votes
0 answers

Why does returning EmptyView make AsyncImage not work?

This code loads the image: AsyncImage(url: URL(string: "https://ychef.files.bbci.co.uk/976x549/p01j3jyb.jpg")) { phase in switch phase { case .success(let image): image .resizable() .frame(width: 140, height:…
Marty
  • 5,926
  • 9
  • 53
  • 91
0
votes
0 answers

AsyncImage inside ForEach Loop

I'm using stock AsyncImage to load an image from Firebase Storage to my app. I'm using two exactly same fragments of code to load the same image however the app compiles only when there is only the first fragment, the second one causes crash. The…
Vader20FF
  • 271
  • 2
  • 9
0
votes
1 answer

TabItem + AsyncImage - image is extremly big

I'm trying to load image async using AsyncImage - but the results is that the image is very big and covers all the screen. TabView { CreateView() .tabItem { Image(systemName: "plus.circle") …
Udi Oshi
  • 6,787
  • 7
  • 47
  • 65
1
2