Post

Replies

Boosts

Views

Activity

Compiler Error with SwiftUI Project on iOS 13 on Xcode 12
I'm getting an error when trying to compile my project using xcode 12. The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions The compiler hints that the error is at the last modifier .offset() in this snippet: func circle(geometry: GeometryProxy, index: Int) -> some View {     return Circle()       .fill(Color.mediumGray)       .frame(width: geometry.size.width / 5, height: geometry.size.height / 5)       .scaleEffect(!self.isAnimating ? 1 - CGFloat(index) / 4 : 0.1 + CGFloat(index) / 5)       .offset(y: geometry.size.width / 10 - geometry.size.height / 2)   }
5
0
3.4k
Jun ’20
Core Data Background Context vs Main Context
Hi, I'm working on an app where I'm using Core Data to store some information on persistent storage. I'm having issues understanding and deciding how to deal with read/write operations. At the moment, I have a QuoteGroupStorageManager class that wraps most of the operations in easy to use functions. You can see it below. You can see that I'm fetching on the main context, and editing/deleting/inserting (apart from the addQuoteToGroup which I do on the mainContext because I use relationships, and the quoteGroup belongs on the mainContext - otherwise I get an error with illegal... object belongs to a diff context). My question is, am I doing things right, in terms of performance? I'm using SwiftUI for the UI and when I delete a QuoteGroup for example, the UI is freezing for a while, until I make a new deletion. I'm wondering if it's because of the mixture of backgroundContext and mainContext. Which one should I use? QuoteGroupStorageManager.swift - https://developer.apple.com/forums/content/attachment/9226d66b-9e56-46ed-a734-389927340864 Thanks!
1
0
1k
Jul ’20
UIImpactFeedbackGenerator seems to break SwiftUI Previews in Xcode 12
Hi! I created a custom modifier which looks like this: extension View {     func onTapGestureWithFeedback(action: @escaping () -> Void) -> some View {         let impact = UIImpactFeedbackGenerator(style: .medium)         let defaults = UserDefaults.standard         let reduceHaptics = defaults.object(forKey:"reduceHaptics") as! Bool         return self.onTapGesture {             if !reduceHaptics { impact.impactOccurred() }             action()         }     } } For some reason, while I use this modifier on a view, like this struct TestView: View {     var body: some View {         Text("Hello World")             .onTapGestureWithFeedback {                 print("test")             }     } } the SwiftUI Preview breaks. This is the error I'm getting in the diagnosis window: MessageSendingError: Connection interrupted: send message to agent. This used to work fine in Xcode 11. Please find attached the crash log as well. Crash Log - https://developer.apple.com/forums/content/attachment/de0b6862-77af-4323-a22a-f58d61983022
2
0
799
Jun ’20