In Swift 6, stricter concurrency rules can lead to challenges when making SwiftUI views conform to Equatable. Specifically, the == operator required for Equatable must be nonisolated, which means it cannot access @MainActor-isolated properties. This creates an error when trying to compare views with such properties:
Error Example:
struct MyView: View, Equatable {
let title: String
let count: Int
static func ==(lhs: MyView, rhs: MyView) -> Bool {
// Accessing `title` here would trigger an error due to actor isolation.
return lhs.count == rhs.count
}
var body: some View {
Text(title)
}
}
Error Message:
Main actor-isolated operator function '==' cannot be used to satisfy nonisolated protocol requirement; this is an error in the Swift 6 language mode.
Any suggestions?
Thanks
FB: FB15753655 (SwiftUI View cannot conform custom Equatable protocol in Swift 6.)
Post
Replies
Boosts
Views
Activity
Hello community:
Is there any way to change the button color of the screen time permission to match app style?
Anyone with the same problem?
Hello:
I was checking the app size on the AppStore and seems like it is randomly different from one app to others. For example one app shows 27.6MB in the App Store and then when you download the size is 51.9 MB and 2.5MB of documents and data whereas another marks 88.8MB and then when you download the size is 86.3 MB and 2.5MB
How the AppStore calculate these sizes?
Hi community:
I'm experiencing an issue in iOS 17 where the Widgets and Extensions use the local device language instead of the app language (preferred languages displayed on the app settings). This issue was reproducible in iOS 16.1, but then was solved. Now it is back on iOS 17 and iOS 17.1
In terms of code, Locale.current in the app returns the language preference selection, even you can use bundle.main.preferredlanguages and get the first one (because there's a repetition from 2 to 3 times the same value)
But in whatever extension, the app's preferred language cannot be got, it always returns the system's preferred language.
@eskimo, Is it a known issue?
Also, Xcode 15.3 shows 0 files localized when you use the strings catalog.
I appreciate any help you can provide.
Hi community:
I found that after Xcode update from 14.3.1 to 15.0.1, my UITests fail only on the CI (Apple Xcode Cloud) because the use of boundElementsByIndex.
Seems that the use of this property stale the main thread:
Failed to resolve query: Unable to perform work on main run loop, process main thread busy for 30.0s
Is it a known issue?
Thanks
Hi, community:
I was trying to move from application(_:open:options:) (UIKit) to
onOpenURL(perform:) (SwiftUI). Maybe there's something that I'm missing.
In UIKit you can say to the system that you won't handle the URL then the app is not opened, but when I use onOpenURL(perform:) it is always opened. Is there any way to achieve the same behavior?
Thanks in advance.
Hi community:
I'm trying to replace it with drag-and-drop images in assets.
I know for example that by adding a suffix @2 and @3, you can drag and drop and Xcode knows where they must be.
Also, I remember that it could be possible to add a suffix like ~dark or ~light.
There's no official documentation about it but I'm looking a way to drag and drop and autodetect assets per language. I've tried:
image_es@fr.png
image_fr@2x.png
image_fr@3x.png
But doesn't work.
Any ideas where I can find the docs? Or can someone provide documentation about it?
Thanks in advance.
After archiving no artifacts could be found but the release is in the Testflight, it has been happening since this morning.
Do you have any ideas about how can I solve it?
Thanks.
@eskimo @meaton
Update: The 501 (Not Implemented) status code indicates that the server does not support the functionality required to fulfill the request
Hi community:
Is there any way to create a Privacy report from the command line?
Thanks
Hi community:
I'm trying to create a form PDF form a script in swift on Mac
First approach was trying to add a simple and static text not collapsible. But I tried multiple options. And all ends on something that is not a static text.
The best approach was to create a textfield not editable with widget PDFKit, but when you go to the preview app on Mac and pass the the mouse over the field, it is highlighted in blue ...
Thanks for the support.
Hi there:
I was testing many different ways to sync text editor and keyboard movement, but always I obtain a delay or not exacting the same keyboard movement.
How can I get it?
The best way that I got is using a safe area inset, but always start later and ends before the keyboard movement.
Thanks in advance.
(Any solution including bridge between swiftui and UIKit will be much appreciated if the movement sync is right)
Hello community:
I have some questions about xcprivacy and third parties. I was talking to a third party owner and he told me that in PrivacyInfo.xcprivacy you only need to declare the minimum things to use the third party.
For example, the third party uses the user's default value to save data about the application, but also if he has extensions, he uses it to communicate data between the application and the extension. Just declare the first one.
Also, it retrieves purchase history and there's a way to use it anonymously (although in my opinion it is not the most used feature by this third party) so the data is not linked to anyone, but if you use a user identified with Apple ID, purchase history is linked to it.
So if the third party only declares the minimal things that he uses, how can we know the rest of the data/api uses? Is this approach correct?
Hi Community:
I want to know (if someone knows) why content filters are only available for:
Supervised devices
Apps with Screen time, but only for children.
Is that make any sense while in Mac is supervision is not needed?
Why adults cannot decide to use a built in content filter instead of using screen time pre-filter by them selves?
Are they no conscious about what are they doing?
Are there any UX question to not open this powerful tool to improve an iOS user experience guided by third parties?
Thanks in advance.
Hello:
I was reading about Mail Privacy Protection because a customer issue case, and how it don't work with VPNs. The final user sees all the time a message on the email top, and then the final user claims to the vpn owner.
Which are the hostnames to set in the VPN as whitelisted to remove the message from there?
Thanks in advance