Post

Replies

Boosts

Views

Activity

Build Errors for Reality Composer Pro Packages in Xcode 16 Beta 6 for iOS 18
Using Xcode 15.4, I have successfully built and run my app using Reality Composer Pro Version 1.0 package. I then successfully submitted that app version for release. Now, using Xcode 16 Beta 6, I've created a new branch repository for updating my app for iOS/iPadOS 18 and visionOS 2. However, once I created and switched to the new branch and did a build, I get build errors. It seems to be regarding the package manifest that relates to my Reality Composer Pro package that is part of my app. When I go to the package file in my project navigator and click the Open in Reality Composer Pro button, my package opens in Reality Composer Pro 2.0, which makes sense since it it the version for Xcode 16. However, I don't know how to address/get rid of the build errors. I've added and image of my build errors.
5
0
1.1k
Sep ’24
Combining Xcode Boilerplate Core Data/CloudKit Code with an MVVM architecture
I’m practicing with creating a multiplatform App (could just as well be an iOS app) using the boilerplate code generated by Xcode when Core Data and CloudKit check boxes are selected upon project creation. Xcode generates a persistence.swift file with the Core Data stack code and uses the @FetchRequest property wrapper in the ContentView.swift file. However, I’d like to move some of the more “view model” or non-UI boilerplate code out of ContentView and into a more MVVM-like view model class file so that I keep the ContentView focused on my UI. I would like to continue using the provided persistence.swift file as my Core Data manager content. Can I still use the power of @FetchRequest in the ContentView (I think it has to remain in my content view), while moving the other boilerplate code Xcode generated out of ContentView to a new view model class file? For example, I’m talking about the automatically generated code for addItem() and deleteItem(). In other words, can I use both the @FetchRequest approach for accessing my entity model while also making my code fit a more MVVM architecture?
0
0
991
Jun ’21
How can I update/save a Property Change for Child Item from a Hierarchical List View of Items
How can I update/save a Property Change for Child Item from a Hierarchical List View of Items See the following app screens: Content View Screen: Content View with hierarchical list children rows disclosed:  Parent Row Detail View: Child Row Detail View:  Referencing the above views, here are the steps I do and the resulting problem I’m trying to solve: Launch the app. From the Functions (Content View) presented at launch, see that there is one item listed in a list view (1.0 Move Vessel) Click the yellow (my app accent color) disclosure arrow at the right of the list item. Two subordinate child list rows appear under the parent list item, 1.1 Move Position and 1.2 Hold Position. When I tap the parent item (1.0 Move Vessel) in the hierarchy list, I'm successfully able to navigate to a detail view for that tapped item.  Edit the description of the 1.0 Move Vessel item (defaults to test) of the tapped item properties in the detail view using a TextEditor view.  Click yellow Save button at top left of detail view. The app navigates back to the parent Functions (Content View). Click on the parent 1.0 Move Vessel row again. See that description was successfully saved and now displayed from the change made in Step 5 and 6. Repeat steps 5 through 8 again for 1.1 Move Position list row. See that the edit/change made to the description was not saved and the default test1 description is displayed instead (not what is wanted). Repeat steps 5 through 8 again for 1.2 Hold Position list row. See that the edit/change made to the description was not saved and the default test2 description is displayed instead (not what is wanted). I think I may have a problem in my save code logic and I'm trying to investigate. Here are the swift files for the Detail View, the View Model, and the Model (I’ve not included the content view code because that code is working ok with the detail view. Again, I think the problem is in my save button and function call code for updating the view model. NOTE: sorry that I can’t seem to figure out how to get all the code for a file contiguous in the code view. I seem to have some closing braces that don’t appear in the code view. I think you can still follow the code. FunctionDetailView.swift struct FunctionDetailView: View { @State var vesselFunction: VesselFunction @State var vesselFunctionDescription: String @Environment(\.presentationMode) var presentationMode @EnvironmentObject var functionViewModel : FunctionViewModel var body: some View { NavigationView { Form { Text("Enter description below") TextEditor(text: $vesselFunctionDescription) .frame(height: 200) .toolbar { Button { //print(vesselFunction) vesselFunction.funcDescription = vesselFunctionDescription //print(vesselFunction) functionViewModel.updateVesselFunction(vesselFunction: vesselFunction) //print(vesselFunction) presentationMode.wrappedValue.dismiss() } label: { Text("Save") } } } .padding() .navigationTitle(vesselFunction.name) .navigationBarTitleDisplayMode(.inline) } } } struct FunctionDetailView_Previews: PreviewProvider { static var previews: some View { FunctionDetailView(vesselFunction: VesselFunction(id: UUID(), name: "x.x Verb Noun", funcDescription: "Description", children: nil), vesselFunctionDescription: "placeholder") .environmentObject(FunctionViewModel()) .preferredColorScheme(.dark) } } FunctionViewModel.swift @MainActor class FunctionViewModel: ObservableObject { @Published private(set) var decomp : [VesselFunction] = [ VesselFunction(id: UUID(), name: "1.0 Move Vessel", funcDescription: "test", children: [ VesselFunction(id: UUID(), name: "1.1 Move Position", funcDescription: "test1", children: nil), VesselFunction(id: UUID(), name: "1.2 Hold Position", funcDescription: "test2", children: nil) ]) ] func updateVesselFunction(vesselFunction: VesselFunction) { // // if let index = decomp.firstIndex(where: { //(existingVesselFunction) -> Bool in // return existingVesselFunction.id == vesselFunction.id // }) { //run this code // } // cleaner version of above if let index = decomp.firstIndex(where: { $0.id == vesselFunction.id }) { decomp[index] = vesselFunction.updateCompletion() } // else { // for item in decomp { // if item.children != nil { // if let index = item.children?.firstIndex(where: { $0.id == vesselFunction.id }) { // item.children![index] = vesselFunction.updateCompletion() // } // } // } // } } } FunctionModel.swift struct VesselFunction: Identifiable { let id : UUID let name : String var funcDescription : String var children : [VesselFunction]? init(id: UUID, name: String, funcDescription: String, children: [VesselFunction]?) { self.id = id self.name = name self.funcDescription = funcDescription self.children = children } func updateCompletion() -> VesselFunction { return VesselFunction(id: id, name: name, funcDescription: funcDescription, children: children) } } As you can see from the else and for-in loop code commented out at the bottom of the FunctionViewModel code, I was trying to see if I needed to do something like this code to access the children VesselFunction array entries of the decomp published property. With the if let index code that is not commented out, the save function works but only for the top-level decomp array VesselFunction elements, not the nested children arrays elements. Any help would be appreciated so all decomp array elements, both parent and nested children, can be updated when the TextEditor field is changed and the Save button is pressed in the FunctionDetailView. NOTE: I am only showing a 1 level deep nested array of children for the decomp property. I actually want to have multiple (at least 3) level of children arrays, so if you have any ideas how to make an updateVesselFunction function work for multiple children array elements, I would appreciate it.
0
0
811
Feb ’22
Converting from local device @AppStorage to Core Data + CloudKit
I want to add Core Data/CloudKit data persistence to my app. Currently my app only uses local on device @AppStorage. Looking for best approach to bring in @FetchRequest functionality for my views, and tie my model data into Core Data and CloudKit.  In my app currently (without Core Data) my content view has an instance of my view model (separate file) accessed using an Environment Object. I use local @AppStorage persistence. See below for my Current app architecture: In my lab this week, i got suggestions that I can modify my app structure to incorporate Core Data + CloudKit. Would the following structure work?:
0
0
936
Jun ’22
Recommendation on How to Learn More on Using Various Xcode Debugging Panes
I don’t have a fundamental background in Computer Science or Computing Engineering. I want to learn more about how to do code debugging, but within the bounds of how Xcode provides various debugging panes. I’ve seen a number of WWDC session videos about Xcode and debugging. However I really need to learn more about the fundamentals of using Xcode panes like the stack trace pane, the variables pane, and the debugging console. I would greatly appreciate any advice on tutorials, videos, WWDC sessions, etc. that go to the basic levels of what these panes show, how to interpret the content, and how to interact with the information in various Xcode debugging-related panes. Thank you.
0
0
1k
Jun ’22
My App Application Bundle Unexpectedly Appears in my Xcode Project Navigator
Running Xcode 15.4, macOS Sonoma 14.6.1. Recently, within the last month, an application bundle item is showing up in my Xcode project navigator under my application hierarchy. It looks just like my application target. When I look at the file inspector for this, it indicates it is an Application Bundle type, but the full path is in my Users//Library/Developer/Xcode/DerivedData.....Finder location. When I delete this project navigator object, close Xcode, then re-open Xcode, the application bundle reappears in my project navigator. Why am I recently seeing this in my project navigator? Should I retain it? When I click on it and inspect in the file inspector, the target membership to my app is not checked. Should I check it? Why would I want/need this DerivedData application bundle in my project navigator?
0
0
370
Aug ’24