|
Hi, everyone. Currently, I am on Milestone projects 10-12 and stuck. So, where I am:
So, when I run the app everything works fine: I can open the picker and add photos saved on my phone. When I click on the photo, the Detailviewcontroller appears, BUT... but the photo is not displayed for some reason. I have already been stuck for two days))) and somehow I know where the problem is:
Now I know that for some reason my imageView.image is left "empty". But everything that I have tried is not working. So, the question why dosn't my imageView.image work? and why while I run the app my detail view controler is not showing the image? I would be extremely grateful if someone would help me to solve the problem. |
|
Hi @Mykola! I suspect you forgot to retrieve the path. You saved the image before displaying it in DetailView so it should be something like this.
for Picture Class you can use this:
|
|
@ygeras Thanks a lot! I have tried but it still does not work. So I will share all my code with you)
Now DetailView with your suggestions:
and here is my Picture class:
I would be very appreciated if you check the code! |
|
Your mistake most probably here in DetailView
you have to pass it as
also in didSelectRowAt pass a string not an object Picture
if it doens't help let me know. Will check line by line tomorrow :) |
|
@ygeras It still does not work) Please, check it by the line tomorrow. 🙏 Have goot night!) |
|
Now cannot fall asleep )))) unless try to solve it. So let's start with ViewController Class
In DetailView basically we leave the same.
So the issues should have been also here appendingPathExtension(imageName). You added it as a file extension to save not as PathComponent. PS Before running on simulator, delete app so that all leftovers from previous app are gone. |
|
|
|
BUILD THE ULTIMATE PORTFOLIO APP Most Swift tutorials help you solve one specific problem, but in my Ultimate Portfolio App series I show you how to get all the best practices into a single app: architecture, testing, performance, accessibility, localization, project organization, and so much more, all while building a SwiftUI app that works on iOS, macOS and watchOS.
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.