-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Swift 6 language mode #15
Conversation
* Make models conform to Sendable * Remove private static 'shared' property because it was not used * Mark collection methods as @mainactor
* Update to modern Xcode project settings * Enable Swift 6.0 language mode
Sources/Q42Stats/Q42Stats.swift
Outdated
DispatchQueue.main.async { | ||
self._log(key: "Watch_paired", value: session.isPaired.description) | ||
} | ||
self._log(key: "Watch_paired", value: session.isPaired.description) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do we guarantee self._log(
is only accessed from the same thread?
- Could we make
Q42Stats
an actor to isolate access tovar collected: [String: String]
?
That'd interfere with theWCSessionDelegate
conformance though… - Or wrap it in some
Box<T>
?
actor Box<T: Sendable> {
private var value: T
init(_ value: T) {
self.value = value
}
func get() -> T {
return value
}
func set(_ newValue: T) {
value = newValue
}
}
- Or just mark the property
@MainActor
🤷🏻♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Marking it as @MainActor
would have my preference since it's the simplest :)
By the way, we probably should update |
That might break older project which aren't on Swift 6 yet. Since it's only the minimum tools version, we can leave it for now |
In this PR:
Support Swift 6 language mode
Update Demo app to modern settings