1. Camera Photos SwiftData: DataModel and View Setup

  Рет қаралды 2,478

Stewart Lynch

Stewart Lynch

Күн бұрын

Пікірлер: 49
@vladimirmoor
@vladimirmoor Ай бұрын
Great job on the explanation! The video is packed with tons of small yet meaningful details that really make a difference. Much appreciated!🥰
@StewartLynch
@StewartLynch Ай бұрын
Awesome, thank you!
@predicked
@predicked 2 ай бұрын
Great content, Stewart! This tutorial on setting up the DataModel and View for Camera Photos in SwiftData is incredibly clear and well-structured. The step-by-step guidance made it easy to follow along, and I appreciate how you broke down the complex concepts into manageable parts. Thanks for providing such valuable content. Looking forward to other app tutorials.
@StewartLynch
@StewartLynch 2 ай бұрын
Glad you found it helpful
@dmacharo
@dmacharo 6 ай бұрын
What a treat! Can't wait for the rest of the series, thanks a million Stuart!
@andrejkling3886
@andrejkling3886 6 ай бұрын
Thank you so much Stewart 💯
@BlerdGrid
@BlerdGrid 6 ай бұрын
Hey Stewart, thanks for this video series! It's helping me get through a project I'm working on. I'm hitting an error that I can't figure out though. When I add the "List(samples)" closure I get a "Failed to produce diagnostic for expression" error. I removed that block of code and the error went away...so my question is, would I need to add a "if let" to unwrap the image(s)? Thanks again!
@StewartLynch
@StewartLynch 6 ай бұрын
I doubt that would be the problem. Without seeing your project it is difficult to to comment on what might be causing the issue.
@lfan_tv
@lfan_tv 5 ай бұрын
Hi, for the image I need to do like this else it will popup the error Image(uiImage: (sample.image == nil ? Constants.placeholder : sample.image)!) do you know why?
@StewartLynch
@StewartLynch 5 ай бұрын
Does it give the same error if you check my completed source code for this branch?
@gcoldfyre
@gcoldfyre 3 ай бұрын
@@StewartLynch it does for me. When I add that line I get a "Failed to produce diagnostic for expression, please submit a bug report." I tried with both the completed code from source branch 2 and 3 as well but this line remains the same and gives me a Failed to build PhotosListView.swift error on the app
@StewartLynch
@StewartLynch 3 ай бұрын
I just downloaded and tested the completed code for this project and get no errors.
@gcoldfyre
@gcoldfyre 3 ай бұрын
@@StewartLynch Yep, I ran it from your project and it worked fine. I don't see any differences between your code and mine but thanks for the reply. Loving your series so far! I'll continue through this example now.
@mkhasson97
@mkhasson97 6 ай бұрын
Thank you very much for you awersome videos and the perfect explainations
@StewartLynch
@StewartLynch 6 ай бұрын
Glad you like them!
@dirkfu6280
@dirkfu6280 6 ай бұрын
Hi Stewart, great video again, can't wait to find out what solution you came up with in the camera part, especially because there is no SwiftUI API (yet?). Small nitpick: Instead of Image (uiImage: sample.image == nil? Constants.placeholder : sample.image!) whouldn't be Image (uiImage: sample.image ?? Constants.placeholder) much simpler?
@StewartLynch
@StewartLynch 6 ай бұрын
You are correct. Simpler indeed
@joywu1
@joywu1 6 ай бұрын
I had seen your old series in this function(not swift data), but can you add one more function is when I pick the photo will show the photo on map?
@StewartLynch
@StewartLynch 6 ай бұрын
That would be another level and some reverse geocode lookup on the meta data.
@joywu1
@joywu1 6 ай бұрын
@@StewartLynch thank you for your explanation, would you have any plans to this function in the future serious?
@StewartLynch
@StewartLynch 6 ай бұрын
@@joywu1 I have a lot of other videos planned right now but I will add this to my list
@marcskieskie6493
@marcskieskie6493 2 ай бұрын
Hello, How make for take photo in square (1:1) mode ? or allow the user to switch the mode (4:3, 1:1; 16:9) ?
@StewartLynch
@StewartLynch 2 ай бұрын
You will have to design your own camera. This one that you get is pretty basic unfortunately.
@marcskieskie6493
@marcskieskie6493 2 ай бұрын
@@StewartLynch Thanks for your reply. I'll give it a try.
@mhfs61
@mhfs61 4 ай бұрын
Thank you Stewart.
@StewartLynch
@StewartLynch 4 ай бұрын
You are very welcome
@Johnson4o
@Johnson4o 4 ай бұрын
The placeholder images are not visible in dark mode, is there any way to fix this? The image generated by systemImage is gray, so it’s perfectly visible in dark mode, however the image generated by systemName is black with transparent elements, so it becomes completely invisible in dark mode. Otherwise awesome tutorial, thank you!
@StewartLynch
@StewartLynch 4 ай бұрын
Try changing the constant to this: enum Constants { static let placeholder = UIImage(systemName: "photo.fill")!.withRenderingMode(.alwaysTemplate) }
@sergiovinhal5934
@sergiovinhal5934 6 ай бұрын
Thank you .
@RaethanChristianSupatan
@RaethanChristianSupatan 6 ай бұрын
Hi! I tried storing multiple photos as an array of data but when I try to display them in a lazyvgrid, the performance of the app become slow. Is there any way to improve performance if there are a lot of photos to be displayed?
@StewartLynch
@StewartLynch 6 ай бұрын
Do you mean you have a property that is an array of Data? If so, create a new object with a Data property and then store as a one to many relationsip to that object.
@RaethanChristianSupatan
@RaethanChristianSupatan 6 ай бұрын
@@StewartLynch Is that the reason why performance was slow? Also, can I not store my array of data property to external storage?
@StewartLynch
@StewartLynch 6 ай бұрын
I have been reading that this is problematic. I have had no issues using one to many releationship.
@RaethanChristianSupatan
@RaethanChristianSupatan 6 ай бұрын
@@StewartLynch I see tysm!
@raethansupatan7341
@raethansupatan7341 6 ай бұрын
Is there a way to load the image data asynchronously?
@isaiasizquierdo3369
@isaiasizquierdo3369 6 ай бұрын
Thank you
@StewartLynch
@StewartLynch 6 ай бұрын
You're welcome
@RoxieS-pv4ke
@RoxieS-pv4ke 6 ай бұрын
make a video how to add an array of images or videos to a SwiftData, and I'm wondering right now if I store images not in a Data? but in an URL? ,,, it will be very interesting, there are no such lessons on KZbin
@StewartLynch
@StewartLynch 6 ай бұрын
This is pretty straight forward. Whether you are saving as a URL or as Data, create a new model for the image. It might only have the single property for the data or url. Then you can link the array to your object as a one to many relationship.
@RoxieS-pv4ke
@RoxieS-pv4ke 6 ай бұрын
@@StewartLynch yes, but I think the second property needs to be included in the new photo model is ID
@StewartLynch
@StewartLynch 6 ай бұрын
Id is not necessary a Swift data model already has a record Id.
@RoxieS-pv4ke
@RoxieS-pv4ke 6 ай бұрын
@@StewartLynch today I will try to change the code a little)) and then I did it in my model using an attribute, it works - adds an array of photos, but when deleting an entry, it throws it out of the application
@StewartLynch
@StewartLynch 6 ай бұрын
@RoxieS-pv4ke What do you mean, throws it out of the application? What is your delete rule on the relationship?
2.  Camera Photos SwiftData: Update/Edit and PhotoPicker
19:01
Stewart Lynch
Рет қаралды 1,1 М.
5. Swift Data One to Many Relationships
25:58
Stewart Lynch
Рет қаралды 9 М.
У вас там какие таланты ?😂
00:19
Карина Хафизова
Рет қаралды 24 МЛН
PIZZA or CHICKEN // Left or Right Challenge
00:18
Hungry FAM
Рет қаралды 15 МЛН
Из какого города смотришь? 😃
00:34
МЯТНАЯ ФАНТА
Рет қаралды 1,6 МЛН
Disrespect or Respect 💔❤️
00:27
Thiago Productions
Рет қаралды 37 МЛН
9. SwiftData Storing Images and Bug Fixes
23:15
Stewart Lynch
Рет қаралды 4,5 М.
Deep Dive into TabView Changes in iOS18
32:07
Stewart Lynch
Рет қаралды 3 М.
SwiftUI Camera View | AVKit Or Combine?
16:57
Swift Academy
Рет қаралды 4,4 М.
SwiftData & CSV - Recipe App
37:37
Oliver Baumeister
Рет қаралды 1,8 М.
New SwiftUI Photo Picker - Single & Multiple Selection
12:42
Sean Allen
Рет қаралды 11 М.
SwiftData Updates - Part 1:  Mock JSON Data and PreviewModifier
29:53
Stewart Lynch
Рет қаралды 2,1 М.
У вас там какие таланты ?😂
00:19
Карина Хафизова
Рет қаралды 24 МЛН