So...I lost most of the Lunch Card files to a factory reset. There was an issue with Disk Utility - it's a whole thing. But I've managed to recover most of the files. But there's something that isn't working anymore within the code.
In SettingsView, where the color scheme ("Appearance") picker is located, you choose between light, dark, and system default.
But when calling the sheet for AddView in CardsView (using SheetInfo() from Info.swift), it just defaults to whatever the system is set at. When I previewed it, it was light mode when the app setting was dark.
Thing is, before I lost all my files, it worked perfectly normal, and consumer versions reflected that. I recovered (and rewrote some of) SettingsView and AddView (thank goodness I showed the full code for AddView here). I may have missed something, so here's my code for both, plus ContentView, CardsView, and Info.swift.
SettingsView.swift - https://developer.apple.com/forums/content/attachment/91ff1182-42d3-48b8-9f8d-be765ee32c43AddView - https://developer.apple.com/forums/content/attachment/06f1b340-4770-49f4-b530-6f27c1b50490CardsView - https://developer.apple.com/forums/content/attachment/4291deb9-ce02-4769-8ccf-d02d9d6908b8ContentView - https://developer.apple.com/forums/content/attachment/12cc3378-8769-4cee-8faa-63af72cc7ab3Info.swift - https://developer.apple.com/forums/content/attachment/89c6710c-faed-4b93-8152-a0f9a95806c8
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Please read the last thread: Call a Class into views - https://developer.apple.com/forums/thread/671482
The right code for the XML parser is almost set in stone, just I need a way to retrieve article data (not just through loadArticles()) like title, author, etc.
I've decided, and was suggested, that I go the same route as my other app, Lunch Card, where there's a function where you use a dataUrl and data to call ArticlesParser(). Thing is, since the code for the XML parser is a bit more complicated, it's harder to pass variables around just like with Lunch Card. There's another class I have to deal with. So I either have to (1) redefine articles the same way with an Array;
@Published var articles: [ArticleInfo] = []
...or (2), find some other way to call articles from the ObservableObject, maybe in a StateObject or ObservedObject.
I want to try and borrow as much code from Lunch Card as possible, but for an XML parser with multiple classes and extensions, it a bit easier said than done. Here's full code for ArticleInfo and ArticlesView.
ArticleInfo.swift - https://developer.apple.com/forums/content/attachment/d16688a9-f420-4dee-b1f4-ed255e325a3eArticlesView - https://developer.apple.com/forums/content/attachment/fbfb99f1-87a7-448b-ad04-54aef6abe61c
Not sure how ArticleInfo is an integer, so I have no idea what's going on or why it's not working as well. Also, I'm trying to experiment with borrowing the JSON decoder/encoder code, so tell me if that's the wrong way to go.