Post

Replies

Boosts

Views

Activity

Reply to NavigationStack and NavigationSplitView Runtime warnings
I created a very simple project as follows. NavigationLink("Go To Next View", value: "TheView")          .navigationDestination(for: String.self) { val in Text("Value = \(val)")          } This example worked in the simple project. But when I put this into my app's project using NavigationStack, I navigated to the next view fine, but had no back button.
Jul ’22
Reply to NavigationStack and NavigationSplitView Runtime warnings
I get the same console message. The only new method of NavigationLink that works with NavigationStack, at least for me, is the form. NavigationLink { MyDestinationView(data: data) } label: {            MyRowView(data: data) } However, I cannot go back in the navigation stack, only forward. No back buttons. But just this morning, I replaced NavigationStack with NavigationView and I had back buttons. I reworked all of my data to fit in the new form. I think that was a good thing anyway, so I want this to work. I could be messing up. Not sure. But with others having the same issue, it could be I'm doing this okay. We shall see.
Jul ’22
Reply to Add a UIImage to a Plane in RealityKit
func placeImageModelEntity(imageAnchor: ARImageAnchor, width: Float, height: Float) {         let imageAnchorEntity = AnchorEntity(anchor: imageAnchor)         imageAnchorEntity.name = imageAnchor.name!         let screenMesh = MeshResource.generatePlane(width: width, depth: 1.33333*width, cornerRadius: 0.5)         var myMaterial = PhysicallyBasedMaterial()         if let baseResource = try? TextureResource.load(named: "MyImage") {             // Create a material parameter and assign it.             let baseColor = MaterialParameters.Texture(baseResource)             myMaterial.baseColor = PhysicallyBasedMaterial.BaseColor(texture:baseColor)         }         let imageModelEntity = ModelEntity(mesh: screenMesh, materials: [myMaterial])         let anchorWidth = imageAnchor.referenceImage.physicalSize.width         imageModelEntity.setPosition(SIMD3(x: Float(anchorWidth), y: 0, z: 0), relativeTo: imageAnchorEntity)         imageAnchorEntity.addChild(imageModelEntity)                  // Add anchor to scene         arView.scene.addAnchor(imageAnchorEntity)     }
Mar ’22
Reply to Loading a RealityKit image texture from a URL
var myMaterial = PhysicallyBasedMaterial()         if let baseResource = try? TextureResource.load(named: "MyImage") {             // Create a material parameter and assign it.             let baseColor = MaterialParameters.Texture(baseResource)             myMaterial.baseColor = PhysicallyBasedMaterial.BaseColor(texture:baseColor)         }
Mar ’22
Reply to sort array of dictionaries
You can create a function which returns a Bool. Here's a simple example. let dict1 = ["Name" : "Wanda", "Age" : 32, "Gender" : "Female"] as [String : Any] let dict2 = ["Name" : "John", "Age" : 25, "Gender" : "Male"] as [String : Any] let dict3 = ["Name" : "Bob", "Age" : 15, "Gender" : "Male"] as [String : Any] let dict4 = ["Name" : "Jane", "Age" : 50, "Gender" : "Female"] as [String : Any] let dict5 = ["Name" : "Bill", "Age" : 75, "Gender" : "Female"] as [String : Any] var dictArray = [dict5, dict3, dict1, dict4, dict2] func dictSort(dict1: [String: Any], dict2: [String: Any]) -> Bool {     guard let i0 = dict1["Age"] as? Int,           let i1 = dict2["Age"] as? Int else {return false}     return i0 < i1 } var sortedArray = dictArray.sorted{dictSort(dict1: $0, dict2: $1)}
Jan ’22
Reply to Apple Watch App - Invalid Swift entry point data
AndyJJ, yes, I have WKExtensionDelegateClassName with value $(PRODUCTMODULENAME).ExtensionDelegate in the extension's Info.plist, but I do not have the delegate adaptor in the AppDelegate. I created a project from scratch and added the watch target and it didn't generate a delegate adaptor. I'm not sure where that comes from. I am not using SwiftUI, just Swift.
Sep ’20