Post

Replies

Boosts

Views

Activity

Reply to View won't update when Core Data object is updated
Thanks for the reply! Here's my code for updating the data     func autosave(note: Note) {         let updateTitle = self.title         let updateBodyText = self.bodyText         let updateDateModified = Date()         viewContext.performAndWait {             note.title = updateTitle             note.bodyText = updateBodyText             note.dateModified = updateDateModified             do {                 try viewContext.save()                 print("Note saved!")             } catch {                 print(error.localizedDescription)             }         }     } And here's where I fetched the data     @Environment(\.managedObjectContext) private var viewContext     @FetchRequest(entity: Note.entity(), sortDescriptors: [NSSortDescriptor(key: "dateModified", ascending: false)], predicate: nil)     var updatedNote: FetchedResults<Note> Which I passed into the other view, which treats the data like a regular variable (code below is in the second view) struct NoteMenuItem: View {     var note: FetchedResults<Note>.Element     var body: some View {         HStack {             VStack(alignment: .leading) {                 Text(note.title ?? "")                     .font(.headline)                     .padding(.bottom, 1)                 Text(note.bodyText ?? "")                     .font(.subheadline)                     .lineLimit(2)             }             Spacer()         }         .padding(.leading, 25)         .padding(.trailing, 25)         .padding(.top, 10)         .padding(.bottom, 10)     } } I don't think I explicitly reloaded the table, since I assumed it does so itself? Though the data still updates in one of the views correctly.
Nov ’20
Reply to iPad Pro 11" Simulator - Split view master table view cell width not correct when rotating to landscape (iPadOs 13.1)
Not sure if this is the same thing, but I've also bumped into an issue with the iPad Pro 11-inch simulator's dimensions. On portrait, the width behaves as though it is a lot longer than the actual device's width. So whenever I try to place an object anywhere based off the screen width, it ends up somewhere entirely different. It works perfectly fine on the other simulators though. Also, I'm on Xcode 12.2, so if it's a bug, I'm guessing they still haven't fixed it yet :(
Dec ’20