Post

Replies

Boosts

Views

Activity

SF symbol effects don't work unless font modifier is applied
why do I need to set the font of an image of an SF symbol to get the effect to work? This should be a bug, it's bad behavior. Xcode 16.1 iOS 18.1, so frustrating. for example: this works Image(systemName: "arrow.trianglehead.2.clockwise.rotate.90.circle.fill") .symbolEffect(.rotate, options: .repeat(.continuous), value: isActive) .font(.largeTitle) .onAppear() { isActive = true } but this does not animate, which makes no sense Image(systemName: "arrow.trianglehead.2.clockwise.rotate.90.circle.fill") .symbolEffect(.rotate, options: .repeat(.continuous), value: isActive) .onAppear() { isActive = true } its the same if you use a simple setup and different font size, and whether font is before or after the symbol effect Image(systemName: "arrow.trianglehead.2.clockwise.rotate.90.circle.fill") .font(.headline) // only works if this line is here .symbolEffect(.rotate, options: .repeat(.continuous))
0
1
163
4w
When to use structs with swift data?
I am unsure the correct way to model my data. I have a swift data object and then some referenced objects. Is there ever a reason those should just be structs or should they always be swift data objects themselves? for example right now this is what I'm doing: @Model final class Exam { var timestamp: Date @Attribute(.unique) var examID: UUID var title: String var questions: [Question] ... } and Question is struct Question: Codable, Identifiable { var id: UUID var number: Int var points: Int var prompt: String var answer: String } is there any problem with this or should I not be using a Struct for Question and instead use another Swift Data object with @Relationship ? I thought since its a simple object just using a struct would be fine, however... when I create a new Question object, it seems to create SwiftUI retain cycles with the warning === AttributeGraph: cycle detected through attribute 633984 === in the terminal for example, Button("Add Question", systemImage: "questionmark.diamond") { let newQuestion = Question(id: UUID(), number: exam.questions.count+1, points: 1, prompt: "", answer: "", type: .multipleChoice) exam.questions.append(newQuestion) } So, is it ok to mix structs with swift data objects or is it not best practice? And is this causing the SwiftUI retain cycles or are the issues unrelated?
2
0
695
Jul ’24