Thanks. Good point about the simulator. I just started to wonder because I noticed my screenshots sometimes need a while to load when I’m checking my apps in the App Store app. And I always use PNG files which are often much bigger than JPG.
Post
Replies
Boosts
Views
Activity
Same problem here. Did anyone manage to fix this? 😕
I have the same problem today with my old MacBook. Xcode worked great until today. I don't know if it's because I've updated Xcode yesterday to v14.0.1. Or maybe this is some backend problem on Apple's side? But you are not alone with this problem.
OK, I've figured it out 🙂 I needed two variables, one per TextField: isFocused1, isFocused2. Each of them changes to true with onEditingChanged. And each onChange has if condition that checks if isFocused for this TextField is true.
Now onChange is triggered only if each TextField is being edited. I have added changing background colors to visualize focus changes.
Working code:
import SwiftUI
struct ContentView: View {
@State private var string1: String = ""
@State private var int1: Int = 0
@State private var string2: String = ""
@State private var int2: Int = 0
let multiplier: Int = 2
@State private var isFocused1 = false
@State private var isFocused2 = false
var body: some View {
VStack {
HStack {
TextField("0", text: $string1, onEditingChanged: { (changed) in
isFocused1 = changed
})
.keyboardType(.decimalPad)
.onChange(of: string1, perform: { value in
if isFocused1 {
int1 = Int(string1) ?? 0
int2 = int1 * multiplier
string2 = "\(int2)"
print("int1: \(int1)")
}
})
.background(isFocused1 ? Color.yellow : Color.gray)
}
.multilineTextAlignment(.trailing)
.font(.largeTitle)
HStack {
Spacer()
Text("x2")
}
HStack {
TextField("0", text: $string2, onEditingChanged: { (changed) in
isFocused2 = changed
})
.keyboardType(.decimalPad)
.onChange(of: string2, perform: { value in
if isFocused2 {
int2 = Int(string2) ?? 0
int1 = int2 / multiplier
string1 = ("\(int1)")
print("int2: \(int2)")
}
})
.background(isFocused2 ? Color.yellow : Color.gray)
}
.multilineTextAlignment(.trailing)
.font(.largeTitle)
}
.padding()
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
Good questions. I would like to know too. I cannot find a good explanation online.
Thanks SeaOverload. But I think it's because I have added CoreData records before activating CloudKit. As written in this article by Grant Grueninger ( I cannot post the link, don't know why)
Your production schema must be correct
In your CloudKit dashboard (with which you should become extremely familiar), you must initialize your development schema and push it to production before you push your app anywhere (even to TestFlight internal testers). If the production schema is incorrect (that is, different than the schema of your app on a device), CloudKit pushes and refreshes can fail, fully or partially (based on what’s different between the schema on the device and the schema in CloudKit) which will make instances of your app appear to silently not sync.
So it seems that I need to: export my data first
delete my app from my phone
turn on iCloud
import data to my app
iCloud should sync after this, hopefully
Unless I will find an easier way
Same here. No logs. And no Telemetry as well. My app is only in dev stage, I am testing with TestFlight. No data.