Post

Replies

Boosts

Views

Activity

Reply to Unable to add new version for my app. Cant see the (+) button besides iOS app.
My issue: I needed to stop the review as I. realized there were issues in my build. My solution: Apps> myApp> Distribution > iOS App (left side panel) > Under Build ... Hover til you see the red minus sign. It will be in the right-hand of the screen, opposite of where your build number is. Click that. You should then be able to add your next update.
Oct ’24
Reply to SwiftUI ForEach on Core Data children list
@SteveRoberson, do you mind sharing a bit about how you made this response work? I'm trying to make this work for something I'm working through but running into issues. I think there's a bit of mystery for me in terms of what your property's were and how they related to this response? So what I'm trying to do is use a FetchRequest to handle a one-to-many object fro core data. So I have an account as a one (the parent), and notes as the many (the children). So really, one account will have many notes. And with this I'm trying to get the notes filtered by way of what their respective account is. To add a bit more complexity to this, some of these views are buried a few layers deep, so they need to have their arguments passed down through each other. Any insights would be appreciated. Thank you.
May ’22
Reply to I could really, really use some help with a concept that continues to hurt my head: Initializing.
The view that displays my list: import SwiftUI import CoreData struct DatabaseViewMain: View { @ObservedObject var refactoringAccount = RefactoringAccount.refactoringAccountSingleton var body: some View { VStack { //Creates the 'add account' button HStack { Spacer() NavigationLink { AddAccountContainer() } label: { SubHeaderViewIcon(subheaderIcon: "plus.square", subheaderIconColor: Color("EditButtonBlue")) } .padding() } //Creates the List view List { ForEach(refactoringAccount.savedAccounts) {account in NavigationLink { AccountDetailMain(accountBackEnd: account) } label: { DatabaseViewCell( accountNameFromCell: account.accountCompanyName, accountLastVisitedFromCell: account.accountCity, accountTotalFromCell: account.accountLastDateVisited) //Text(account.accountCompanyName) } .foregroundColor(.gray) } .onDelete(perform: refactoringAccount.deleteAccount) .onAppear(perform: refactoringAccount.fetchAccount) } .listStyle(PlainListStyle()) } .navigationBarHidden(true) } } The view that my mentor created: import SwiftUI import Combine import CoreData struct AddAccountContainer: View { @State var account: AccountBackEnd? func newAccount() -> AccountBackEnd { let context = RefactoringAccount.refactoringAccountSingleton.container.viewContext let newAccount = AccountBackEnd(context: context) return newAccount } var body: some View { VStack() { if let account = self.account { AddAccountView(accountBackEnd: account) } } .onAppear { if account == nil { account = newAccount() } } } } The View that I’d like to use: import SwiftUI import CoreData //View for user to add a new account with struct AddAccountView: View { @ObservedObject var accountBackEnd: AccountBackEnd @Environment(\.presentationMode) var presentationMode var body: some View { ScrollView { VStack { Group { MainAddHeaderView(mainTextField: "Account", iconField: "building") Spacer() .frame(height: 5) HStack { NavigationLink { CancelButton() } label: { MainHeaderViewBottomLeft() } Spacer() } } Button(action: { do { try accountBackEnd.managedObjectContext?.save() } catch { print("There was a problem saving: \(error)") } presentationMode.wrappedValue.dismiss() print("It exited") }) { LargeSaveButtonBlue(saveButtonLabel: "Save Changes") } OneHundredPointSpacer() //Exit LargeDeleteButton(deleteButtonLabel: "Delete Changes") OneHundredPointSpacer() } .navigationBarBackButtonHidden(true) .navigationBarHidden(true) } } }
Nov ’21
Reply to I'm having trouble refactoring a function call
Ok that helps! Thank you! I ended up re-writing my refactor file to use functions in place of property wrappers. After reading your reply and reading more about Observable Objects, I finally got passed this error: Thread 1: Fatal error: No ObservableObject of type RefactoringAccount found.  A View.environmentObject(_:) for RefactoringAccount may be missing as an ancestor of this view. Turns out I neglected to add ".environmentObject(refactorAccount)" in the first file that loads. I can't remember what it's called, but it's got @main near its beginning. Also, and you'll be happy to know this, my refactor file now only has @Published calls in it. ;) Woot! And now I'm dealing with getting data to store! LOL! The pain never ends. Thanks again!
Nov ’21
Reply to I'm having trouble refactoring a function call
Hey cool. Thanks for taking the time to write back. I get it. I'm a frustrating person to help out. I'm new to all of this, and trying really hard to ask for help, which is hard because sometimes the verbage is lost on me. For example instantiate vs initialize. As another example, last year I didn't understand the concept of scope, but knew there was something going on with my code, where some parts of it weren't being picked up by other parts of my code. Trying to describe in writing what I was working through, and struggling with, to an internet forum is not easy when you don't even know the words to use. Added to this, trying to make sense of Apple's documentation is often times a struggle. And I can't tell you how many countless hours I've spent googling for some form of help while I keep getting nowhere. So that's why I'm here. And in spite what I've just said, I do appreciate your help, and the countless others who have guided me over this last year and a half. It has not been easy. So say for example, when you say instantiate, you clearly don't mean where the object is first established. I think that's initialization. So I'm left thinking you're talking about when it's called into a view. If that's the case, it's here: "    @EnvironmentObject var publishedClassContact: PublishedClassContact. That's in my AddAccountView. If that's not correct, let me know. That's called in my AddAccountView file, because I think I need that in order to run my function to save account entries. Yes it's a class. If I try and refactor I clearly cannot use @EnvironmentObject, so my only option is to use @Published, which then calls for that line of code to be initialized. I've asked for help here before about if the way I'm initializing is proper, and no one seems to be able to tell me. Again, I've struggled with finding out online how to make sense of this. Here's what I'm trying to do, and maybe this will help shed some light on this. If you've made it this far, thank you very kindly for taking your time here: I'm trying to use SwiftUI, Core Data, and property wrappers to create an account list. That list has several attributes per entity. And some of those entities need to connect to other entities. I have not had to wrestle with that yet. I will in time though. I'm sure. My thought is to refactor the logic away from my views, and into classes. The 'PublishedClass' calls are for the entries of data into the account list. For example, some of them are accountAddress, accountPhoneNumber, accountCustomerType etc. That list has those already set as @Published. So again Im trying to have the publishedClass files be separate from the refactor files. Please let me know if this needs clarification. When I use property wrappers, I seem to run into issues, and I think those issues come from my lack of understanding around initializing. Please let me know what parts of this need clarification. Thank you again.
Nov ’21
Reply to I'm having trouble refactoring a function call
Hi @OOPer, and thank you for writing back. I have a class file for instantiating PublishedClassAccount. As far as I can tell, it's doing the trick, but I might be wrong here. At any rate, I'll put it below for review. I do remember you saying that they wouldn't work but I'm lost as to how I would create an object in the @Environment call anyway. I'll put that code below first:     @Environment(\.presentationMode) var presentationMode As well, here's my code for PublishedClassAccount: import SwiftUI class PublishedClassAccount: ObservableObject {     //Account ID & Name     @Published var accountID = UUID()     @Published var accountCompanyNamePublished = ""          //Details     @Published var accountCustomerTypePublished = ""     @Published var accountLastDateVisitedPublished = ""     @Published var accountManagerPublished = ""     @Published var accountMarketTypePublished = ""     //Address     @Published var accountAddressPublished = ""     @Published var accountCityPublished = ""     @Published var accountPostalCodePublished = ""     @Published var accountProvincePublished = ""          //Contact Type     @Published var accountWebsitePublished = ""     @Published var accountEmailAddressPublished = ""     @Published var accountPhoneOnePublished = ""     @Published var accountPhoneTwoPublished = "" //    @Published var toContacts: NSSet? //    @Published var toQuotes: NSSet? //    @Published var toNotes: NSSet?      }
Nov ’21
Reply to I can't get a button to work, instead I get this error: "Accessing StateObject's object without being installed on a View. This will create a new instance each time." Help?
Pardon me. I'll add those below: PublishedClassAccount: import SwiftUI class PublishedClassAccount: ObservableObject {     @Published var accountNameForCoreData = "" } AccountBackEnd (Is my entity for Core data) import Foundation import CoreData @objc(AccountBackEnd) public class AccountBackEnd: NSManagedObject { } .... am I doing any of this right? I feel so deflated.
Nov ’21