Post

Replies

Boosts

Views

Activity

Reply to Adding an entity to a Core Data model prevent Canvas Preview to show
Thanks for sharing alpennec, I had this issue today running Xcode 12.3 (12C33) with the same error. The command recommended by the Frameworks Engineer resolved the issue for me; thanks for sharing! Just an FYI for the next dev, this happened despite being in the early stages of defining Core Data entities (no data had been persisted to the store yet, just in-memory preview data for the canvas). Anybody have a good workflow for setting up entities without causing issues?
Dec ’20
Reply to Multiplatform template with watchOS?
I tried this with Xcode 14.2 but got this message: "Project" already exists. The project "Project" already contains a target named "Project". Please choose a different name. This is what allowed me to add a WatchOS app to a Multiplatform project and share the SwiftUI app lifecycle and root views. File > New > Target… Under the WatchOS tab select App and press Next. Set the product name (we'll change this later). You'll probably want to set your watch app to be "Watch App for Existing iOS App" for this workflow (note that there's a later step if you want to allow the watch app to run independently of the iOS app). Click Finish. Select your .xcodeproj and you'll see a new Watch App target (and test targets if you elected for them) in the Targets section of the sidebar. Select the Watch App and on the General tab you can change the Display Name to match your other targets. Click the Watch App target again while it's highlighted to edit the name. I changed mine from "MedicineWatch Watch App" to just "Medicine Watch App". If you want to allow the watch app to run independently of the iOS app: In the Watch App target's Build Settings tab, find Info.plist Values and change "App Can Run Independentlv of Companion iPhone App" to Yes. To have the watch app use the same shared SwiftUI app lifecycle file and root view: delete the [Name]App.swift and ContentView.swift files in the Watch App directory. Then add the watch target to the lifecycle file and any views using the inspector. (If you included Core Data with the template then you'll also need to add the watch target to the persistence logic and model definition files.) You should now be able to run your multiplatform app on the WatchOS simulator. I've had a few directory renames cause errors but Xcode was able to point me to where I needed to update configurations. Hope this saves some trial and error :)
Mar ’23