Hi,
I noticed that the "View the thread" button recently stopped working in emails of replies from my watched threads.
The link's path seems fine but the subdomain is odd / inexistent, since Safari tells me it cannot find the server.
Did anybody else notice this issue?
Post
Replies
Boosts
Views
Activity
Hello,
I'll describe an issue I just reported as FB15286954, hoping to see your thoughts on it / what might've gone wrong.
Earlier today, I created an account for a website on my iPhone running the release version of iOS 18.0 using Safari, then added 2FA via the Passwords app. I logged in, checked that it works, then closed Safari and did something else (not much on my phone). In the meantime the phone shut down due to low battery.
When I charge it again, and open the Passwords app, I come to find out that the verification codes for this website are gone…
What could've gone wrong? I was prompted by the website to save a code to check that 2FA was properly configured, so I think I saved it properly in the app (by the way, the password was still there, properly saved). I assume there was a syncing error between iCloud and my iPhone due to low battery?
Is there any way to recover the verification codes? I'll try to reclaim the account through the website's support channels, but I'm wondering if I could still retrieve it somehow.
Does the new Image Playground API allow programmatically generating images? Can the app generate and use them without the API's UI or would that require using another generative image model?
Hi! While working on my Swift Student Challenge submission it seems that I found a race condition (TOCTOU) bug in SwiftUI when using sheets, and I'm not sure if this is expected behaviour or not.
Here's an example code:
import SwiftUI
struct ContentView: View {
@State var myVar: Int?
@State private var presentSheet: Bool = false
var body: some View {
VStack {
// Uncommenting the following Text() view will "fix" the bug (kind of, see a better workaround below).
// Text("The value is \(myVar == nil ? "nil" : "not nil")")
Button {
myVar = nil
} label: {
Text("Set value to nil.")
}
Button {
myVar = 1
presentSheet.toggle()
} label: {
Text("Set value to 1 and open sheet.")
}
}
.sheet(isPresented: $presentSheet, content: {
if myVar == nil {
Text("The value is nil")
.onAppear {
print(myVar) // prints Optional(1)
}
} else {
Text("The value is not nil")
}
})
}
}
When opening the app and pressing the open sheet button, the sheet shows "The value is nil", even though the button sets myVar to 1 before the presentSheet Bool is toggled.
Thankfully, as a workaround to this bug, I found out you can change the sheet's view to this:
.sheet(isPresented: $presentSheet, content: {
if myVar == nil {
Text("The value is nil")
.onAppear {
if myVar != nil {
print("Resetting View (TOCTOU found)")
let mySwap = myVar
myVar = nil
myVar = mySwap
}
}
} else {
Text("The value is not nil")
}
})
This triggers a view refresh by setting the variable to nil and then to its non-nil value again if the TOCTOU is found.
Do you think this is expected behaivor? Should I report a bug for this? This bug also affects .fullScreenCover() and .popover().
Is it possible to create SwiftData Document-based apps in App Playgrounds (or Swift Packages, since App Playgrounds are a special type of packages)?
As explained in wwdc2023-10154, to create a document-based app you are required to provide an UTType that conforms to com.apple.package. This requires your file type to be declared and exported in the Info.plist file of an Xcode project, but App Playgrounds don't have them.
Providing .package as a UTType seems to partially work:
import SwiftUI
import SwiftData
@main
struct SwiftDataFlashCardSample: App {
var body: some Scene {
#if os(iOS) || os(macOS)
DocumentGroup(editing: Card.self, contentType: .package) {
ContentView()
}
#else
WindowGroup {
ContentView()
}
.modelContainer(for: Card.self)
#endif
}
}
This way I am able to run the app, create and edit new document, and save it on disk. However, opening it again does not work (you cannot select it since it is a folder without a defined package type).
Is there any workaround to this?
I guess I could drop support for multiple documents entirely if this is not possible (I don't think this would affect my submission), but I would just like to check if there is any way to do this first.
I noticed updating a @Transient attribute's value does not refresh SwiftUI views when using a SwiftData model with @Query or @Bindable.
Here is a sample code (clicking the button changes the Transient attribute):
import SwiftUI
import SwiftData
// SwiftUI App struct declaration
@main
struct MyApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
.modelContainer(for: MyModel.self)
}
}
// My SwiftData test model
@Model
class MyModel {
var myFirstArray: [Int]
@Transient var mySecondElement: Bool = false
init(myFirstArray: [Int] = [Int](), mySecondElement: Bool = false) {
self.myFirstArray = myFirstArray
self.mySecondElement = mySecondElement
}
}
// The SwiftUI View
struct ContentView: View {
@Query var myModels: [MyModel]
@Environment(\.modelContext) var modelContext
var body: some View {
VStack {
if myModels.count != 0 {
Text("Model:")
// I expected this to update when the button is clicked
Text("mySecondElement's value: \(myModels[0].mySecondElement ? "True" : "False" )")
Button {
// button that changes the transient attribute
myModels[0].mySecondElement.toggle()
print(myModels[0].mySecondElement) // this prints the actual value
} label: {
Text("Add mySecondElement data")
}
}
}
.onAppear {
try? modelContext.delete(model: MyModel.self)
if myModels.count == 0 {
let model = MyModel(myFirstArray: [0, 1, 3])
modelContext.insert(model)
}
}
}
}
I expected ContentView() to be refreshed when I clicked on the button. However, this seems to not be the case - it seems that attributes marked with @Transient don't publish updates to Views.
Is this expected behaviour? Should I file a bug / feedback for this?
Hello, is the new Journaling Suggestions API available in App Playgrounds (made using Xcode)?
I know I can add capabilities in Xcode, but it seems that the Journaling Suggestions capability isn't available. I assume this API is currently unsupported in App Playgrounds?
Hi,
In Xcode 14 I was able to train linear regression models with Create ML using large CSV files (I tested on about 30000 items and 5 features):
However, in Xcode 15 (I tested on 15.0.1 and 15.1), the training continuously stays in the "Processing" state:
When using a dataset with 900 items, everything works fine.
I filed a feedback for this issue: FB13516799.
Does anybody else have this issue / can reproduce it?