Тёмный

Persisting to JSON or MarkDown in SwiftUI 

Stewart Lynch
Подписаться 21 тыс.
Просмотров 2,2 тыс.
50% 1

Опубликовано:

 

12 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 23   
@nitesh-maharaj
@nitesh-maharaj Год назад
Thanks Stewart, markdown is an interesting option that I never considered. I've actually worked on some backend services where I embedded JSON Objects into a SQL database. Modern SQL databases even offer you abilities to query JSON using SQL, because sometimes you just want to store a JSON document, but not use a document DB. Something I've learnt from this exercise is always version your model, because it'll inevitably change and your app will need to know how to handle different versions of the data and automatically migrate it to the new version.
@andrejkling3886
@andrejkling3886 Год назад
That’s amazing lessons…. Thank you Stewart ✨✨✨✨
@larschristiansen3136
@larschristiansen3136 Год назад
Thank you Stewart for this new video. Interesting option / alternatives for simple data structures.
@savagedirk9267
@savagedirk9267 Год назад
Remember you can always pretty print json on creation. Also copy and paste directory path in search cmd space. Find quicker than using service.
@StewartLynch
@StewartLynch Год назад
Good tips. Thanks
@rahuljamba5846
@rahuljamba5846 Год назад
Great !!!!!!
@robertdavis7262
@robertdavis7262 Год назад
Great video as usual. It made me want to re-watch the enum video! But the link you gave in the dropdown is to youTube Studio (which doesn't work).
@StewartLynch
@StewartLynch Год назад
Oops. Fixed now
@patgoo2
@patgoo2 Год назад
I like the way you used MarkDown with application data. I wonder what the limit is to the amount of data markdown can handle. Could markdown be used locally as a temp data store for the life of a user session? I've been trying to download and use JSON locally for life of a session but it seems to be slow and unreliable.
@StewartLynch
@StewartLynch Год назад
You would have to test and see. I have not had issues with JSON though as I keep the information in memory and only load on launch. All changes are saved as made.
@obelix8477
@obelix8477 Год назад
You always give great hints to make coding easier. So, I wonder why auto-complete doesn't create do-catch blocks for you? Shouldn't you be able to type docatch, or some other shortcut and let Xcode auto complete this block for you?
@StewartLynch
@StewartLynch Год назад
Yah. I have a code snippet that does that. Normally I just type dtc and it expands for me. You can see this in some of my other videos.
@samuelevans9115
@samuelevans9115 2 месяца назад
I have a SwiftData question for you. Let say you have a Person struct: struct Person { ... person properties } would it be best to save objects of Person directly as Person or encoded JSON? does this save space and have shorter loading time when fetching?
@StewartLynch
@StewartLynch 2 месяца назад
How are you going to save the objects and where?
@aleksandrkravtsov8727
@aleksandrkravtsov8727 Месяц назад
The part about persisting is very useful, but the part about markdown is kind of overengineering (in my humble opinion), isn't it easier to just use appropriate JSON-editor, or simple code editor like VSCode? It has syntax highlighting and prettifier for JSON
@StewartLynch
@StewartLynch Месяц назад
It is just an option. Your choice.
@aleksandrkravtsov8727
@aleksandrkravtsov8727 Месяц назад
@@StewartLynch for sure. I just have never seen anybody using Markdown as database before. But anyways you performed interesting experiment 👍
@user-yj6ng5ql6o
@user-yj6ng5ql6o 9 месяцев назад
Is JSON persistence as a way of persisting data possible in production apps? If you put this app on the app store where would a user's data actually get stored? I'm assuming it wouldn't be on your local computer's file directory? Is the JSON file stored somewhere on the user's local iOS device?
@StewartLynch
@StewartLynch 9 месяцев назад
It is stored in the Application’s Documents directory on the device so not a problem.
@MarkVolkmann
@MarkVolkmann Год назад
Another great video! One thing I couldn't get to work is right-clicking the path to my JSON file in the debug console and selecting "Services > Open". It opens a dialog with a "Run Service" button, but when I click that it opens a Finder window that just shows my home directory. I wonder if the problem is the permissions on my Library directory. I have "drwx------@". Are your permissions different from this?
@StewartLynch
@StewartLynch Год назад
Those permissions should be fine. Are you sure you added .path to URL.documentsDirectory.path when printed to the console?
@MarkVolkmann
@MarkVolkmann Год назад
@@StewartLynch That is what I was missing. Thanks Stewart!
@mhfs61
@mhfs61 Год назад
👍🏼👍🏼👍🏼
Далее
Getting the MOST out of Xcode 16
24:52
Просмотров 2,7 тыс.
А на каком языке ты ДУМАЕШЬ?
00:57
ДОМИК ДЛЯ БЕРЕМЕННОЙ БЕЛКИ#cat
00:45
Xcode Frameworks and Workspaces
19:20
Просмотров 1,9 тыс.
Localized String with iOS + SwiftUI
4:08
Просмотров 648
SwiftUI TextRenderer
28:04
Просмотров 1,5 тыс.
Image Carousel in SwiftUI
18:27
Просмотров 2,3 тыс.
Xcode File Headers and Macros
22:28
Просмотров 1,4 тыс.
iOS 18 SwiftUI ScrollView DeepDive
28:11
Просмотров 1,9 тыс.
Cursor Is Beating VS Code (...by forking it)
18:00
Просмотров 94 тыс.
MeshGradients in iOS 18 and Xcode 15
18:08
Просмотров 1,1 тыс.