Posts

Post not yet marked as solved
1 Replies
123 Views
When I go to Settings and tap on the account, choose iCloud>manage account storage and try to delete the storage associated with an app id developer mode, it doesn't give me the option to delete the data. I have tried using the CloudKit Console to delete the container data, but the entry for the app is still there. How do I delete it?
Posted Last updated
.
Post not yet marked as solved
0 Replies
105 Views
I am converting a large core data app to SwiftData and have hit a problem I can't fix, namely code generated by a Model crashing. Here is the model showing the failing expansion. Here is the model containing the inverse for the failing attribute: /Users/writingshedprod/Desktop/Screenshot 2024-05-08 at 20.21.51.png And here is the mass of core data output generated when the app launches. If anyone can make sense of this I'd be grateful. This is where the problem might lie. Debugger.txt
Posted Last updated
.
Post not yet marked as solved
3 Replies
132 Views
If I annotate a class with @Observable I get this error in @Query: Expansion of macro 'Query()' produced an unexpected 'init' accessor If I remove @Observable the error goes away. Elsewhere I have .environment referencing the class. With @Observable this complains that the class needs to be @Observable. I am mystified. Does anyone have a suggestion?
Posted Last updated
.
Post not yet marked as solved
0 Replies
150 Views
I have spent hours trying to get @Query macros to compile. Mostly they throw up meaningless errors for example the following produces 3 compiler errors: @Query var stylesheets: [StyleSheet] Here's the expansion. The compiler complains that 'private' can't be used here, and it can't find _stylesheets. I searched everywhere to find a resolution then I came across the Query struct. I used it as follows to replace the @Query: let query = Query(FetchDescriptor<StyleSheet>(), animation: .smooth) let styleSheets = query.wrappedValue This also solves another issue that was bugging me - how to get the context when the environment variable is often rejected. All I need to do now is write: let context = query.modelContext None of the WWDC23 SwiftData videos mentions the use of the struct, which is a shame. It feels much like the CoreData approach to fetching data. I hope this helps some of you.
Posted Last updated
.
Post marked as solved
1 Replies
107 Views
Where can I download the code for this app? I know its listed on the video page, but I would like a link to somewhere to download it
Posted Last updated
.
Post marked as solved
2 Replies
198 Views
I have encountered an issue with nested view updates that I don't understand. Maybe someone can explain what is happening. In the code below the ContentView loads 2 views in succession. MyView1 followed by MyView2. MyView displays a button while MyView2 displays the value of its first argument. When the button is pressed MyView1 changes the value of its bound first argument. The ContentView is reloaded because of the change to its first argument. This results in MyView1 and MyView2 both being loaded again. Looked at from a procedural point of view this isn't what I was expecting. import SwiftUI @main struct MyApp: App { var body: some Scene { WindowGroup { ContentView() } } } struct ContentView: View { @State var mydata1:Int = 0 @State var mydata2:Int = 1 var body: some View { VStack { Text("Hello world \(mydata1)") MyView1(v1:$mydata1, v2:$mydata2) Text(" myData1 = \(mydata1) myData2 = \(mydata2) ") MyView2(v1:$mydata1, v2:$mydata2) Text("Bye bye \(mydata1)") } } } struct MyView1:View { @Binding var v1:Int @Binding var v2:Int var body: some View { Text("MyView1") if $v1.wrappedValue == 0 { Button(action: { $v1.wrappedValue = 10 }, label: { Text("OK") }) } } } struct MyView2:View { @Binding var v1:Int @Binding var v2:Int var body: some View { Text("MyView2") if $v1.wrappedValue == 0 { Text("v1 = \(v1) v2 = \(v2) ") } else { Text("???") } } }
Posted Last updated
.
Post not yet marked as solved
3 Replies
244 Views
The project navigator in my project keeps collapsing for no apparent reason. I've hunted high and low but can't find a setting to keep it expanded. This is not a new project and the issue began recently after an Xcode upgrade. I am currently using Xcode 15.3 release candidate. If anyone knows how to fix this I'd be very grateful if they could let me know.
Posted Last updated
.
Post not yet marked as solved
1 Replies
618 Views
I have downloaded the latest beta and tried testing Mac OS Catalyst. It consistently fails with a signing error. I tried using an iPhone 17.2 sim but that failed to install throwing up 'Unable to boot device because it cannot be located on disk', so I reinstalled the sim but got the same error. I then tried 17.4 which simply hangs on the install. So friends, yesterday I was progressing using beta 2, but today I have hit a show stopper. Am I the only one?
Posted Last updated
.
Post not yet marked as solved
0 Replies
225 Views
I have a SwiftUI view that I'm trying to dismiss with a button. Here's the dismiss code: struct MyBackButton: View { var backButton: Bool var dismiss: DismissAction var body: some View { Button( action: dismiss.callAsFunction ) { HStack { if backButton { Image(systemName: "chevron.left") .imageScale(.large) Text("Write!") } else { Text(" ") } }.foregroundColor(Color("AccentColor")) } } } The containing view contains the environment declaration and the button code: struct ProjectView: View { @Environment(\.dismiss) private var dismiss here's the body of the view containing the following modifier that creates the button .configureView("Write!", publisher: publisher, dismiss: dismiss)` When the button is pressed the dismiss action is invoked but nothing happens. I've tried many variants of this code without success. Any help welcomed. I am using Xcode 15.3 beta.
Posted Last updated
.
Post not yet marked as solved
0 Replies
183 Views
Connect says I have to update agreements, tax and banking, but when I try and load the page the browser hangs and doesn't load the page. I am using Safari and Sonoma. This looks like a bug.
Posted Last updated
.
Post not yet marked as solved
5 Replies
5.7k Views
I have just upgraded to Sonoma 14. When I launch Xcode 14.3.1 it says I need to update to the latest version and send me to the AppStore where the latest version is 14.3.1? I have beta Xcode 15 installed, but can upload apps compiled with it to the AppStore. What's going on?
Posted Last updated
.
Post not yet marked as solved
1 Replies
564 Views
After installing beta 8 I'm suddenly getting the following: ld: warning: building for 'macCatalyst', but linking in dylib (/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa.tbd) built for 'macOS' Any help gratefully received.
Posted Last updated
.
Post not yet marked as solved
1 Replies
567 Views
I just installed Xcode beta 6 and tried compiling the SwiftData sample app. It fails with a couple of dozen compile errors. Clearly this must have worked for WWDC23 so what's gone wrong? The following says type 'Card' does not conform to protocol 'PersistentModel' @Model final class Card: PersistentModel { This seems pretty basic. Any suggestions
Posted Last updated
.
Post marked as solved
1 Replies
435 Views
I tried coding along with the WWDC23 'Dive Deeper into SwiftData' video but can't get the sample code to compile. For example the Card class fails with lots of errors associated with @Model. The first of these is: Type 'Card' does not conform to protocol 'PersistentModel' import SwiftUI import SwiftData @Model final class Card { var front: String var back: String var creationDate: Date init(front: String, back: String, creationDate: Date = .now) { self.front = front self.back = back self.creationDate = creationDate } } On the other hand the following stand alone code (in it's own project) compiles without error. So I am confused and a little fed up with Apple publishing sample code that doesn't compile. import SwiftData @Model final class Card { var front: String var back: String var creationDate: Date init(front: String, back: String, creationDate: Date = .now) { self.front = front self.back = back self.creationDate = creationDate } } struct ContentView: View { var body: some View { VStack { Image(systemName: "globe") .imageScale(.large) .foregroundStyle(.tint) Text("Hello, world!") } .padding() } } #Preview { ContentView() }
Posted Last updated
.
Post not yet marked as solved
1 Replies
339 Views
Something weird has happened to my machine. It says it is running Ventura. But I had upgraded to Monterey some time ago. If I go to Software update there is no Monterey option, just a later version of Ventura. A Monterey disk icon appears on my desktop after startup (separate from Macintosh HD). If I open this it's empty. If I eject it it it says Preboot wasn't ejected, if I force that then it says Update wasn't ejected, then finally forcing that says VM wasn't ejected. That gets rid of it until the next restart. Has anyone any idea what is going on.
Posted Last updated
.