Category: Swift5.7
-
Something weird ‘append
I’m noodling around making sure I understand how Core Data works. Thought I’d start with a master/detail app with an array of structs, then replicate it in a Core Data implementation. I’m using an array of this struct for my data: And I thought this code to load up some sample data was pretty sweet.…
-
Console spam – No wall clock alignment
When I was working on the Day 60 app, I noticed I kept getting a message in the console “No wall clock alignment provided at SwiftUI/ResolvableStringAttribute.swift:86” every time I went into the detail view. Via elimination by commenting bits out, I’ve narrowed it down to a date formatting call. Here is the code to reproduce…
-
FriendFace
The Day 60 Milestone is a demo app that vacuums up some JSON and displays it in a list in a NavigationView that links to a details page. Nothing super strenuous, the steps were something like this: 1) Download the JSON and have a look at the structure. Firefox has a simple JSON viewer built…
-
Profile Photo Rabbit Hole
I’m on day 60 of #100Days, and have just wasted most of an evening’s coding time going down a rabit hole I didn’t need to. The app for this challenge is called “FriendFace” and is pretty straightforward: download a heap of JSON which is an array of users. Show it in a list that can…
-
Project 12 Challenges
Project 12 was a series of code tutorials around developing CoreData concepts rather than a real app, but the challenges are based on a very small app that uses a subview to allow dynamic (ie changeable at runtime) filtering of a list of data. The reason this would be tricky is that the @FetchRequest is…
-
Bookworm Feedback
I did so well on this one that it’s not going to make a very interesting post. My first two challenge solutions were pretty much character for character the same – so not much to report. On the third challenge, there was a minor difference in the display process. I had done this: But @twostraws…
-
Bookworm Challenges
Another set of challenges for a #100DaysofSwiftUI tutorial app. Project 11 was a book tracking app – the big new thing was using CoreData. Here’s the challenges for it. Right now it’s possible to select no title, author, or genre for books, which causes a problem for the detail view. Please fix this, either by…
-
@Binding – data between views
In C world, if we want to pass a parameter down into a functional call, and allow the receiving function to change it’s value, we’d pass a pointer to the variable. Something like this: For youngsters, what’s happening is that we’ve set the value of a to 5, then passed the memory address of a…
-
CoreData and the Preview
I’ve noticed Paul is inclined to ignore the preview and run his code in the simulator to check its operation. That’s valid, but it seems quicker, and reassuring, to see it in the preview as I type. This led to a small problem with Day 53 that uses CoreData. When I added a student in…
-
Cupcake Corner Feedback
As usual, here’s my thoughts comparing my attempts at the challenges to Paul’s. Usually he’s better! 1) Whitespace The task was to validate the order address properties, not just by checking they are not empty, but also that they don’t just contain spaces. I went the bruteforce route since there was no .isEmptyIncludingWhitespace method. As…