|
In the app I'm working on the user can select an image from their library and add it to an event. The code is written entirely in SwiftUI but I am using a If the user has already selected an image its uuid is stored in CoreData and returned from this method as a small thumbnail view. And now that I write this I see I need to fix that force-unwrap. I'll do it!
If the user taps the thumbnail image they are presented with a popup view with a large-scale version of the image. That image is displayed inside a
Most pictures display properly but some become stretched along the x-axis. I cannot find a rhyme or reason behind which images display properly and which do not. One theory I have is lower quality images become stretched, but I am not certain. Any insights are appreciated. Here is an example of a distorted image. |
|
Use The original images are not the same size, are they? |
|
I have tried using GeometryReader with the same results, but perhaps I'll tinker with it some more. I cannot find a relationship between the size of an image that works and one that doesn't work. For example an image that doesn't work was taken with the back camera of my iPhone 8+, is 3032 x 4032 and is 1.1mb. While an image that does work is exactly the same dimensions, taken with the back camera of my iPhone 8+ but is 1.7mb. This leads me to belive it is simply a SwiftUI bug, but I just don't know. |
|
|
|
|
|
No luck. The more I play with it the more I think it's a bug. I litterally have two photos in my library taken a half second apart of the same subject. One displays correctly, the other gets squished and stretched. Perhaps someone will run across a similar issue and find a solution, but for now I'm moving on to other areas of the app. Thank you for checking and I'll keep an eye on this of course in case anyone has more suggestions. |
|
|
|
Update: After the Xcode 11.4 update it appears most photos now display correctly. Photos which definitely resized improperly before, now have no issues. However I can still occasionally select a photo from the library which resizes improperly. It might have something to do with whether or not the photo was offloaded from the phone, which then needs to be redownloaded from iCloud. But I can't be sure. |
|
@GeoMod, does this solve the issue completely?
Found this on another Hw/S forum-q&a: |
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!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.