-
Notifications
You must be signed in to change notification settings - Fork 86
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 Sendable
compliant protocols and classes
#254
Support Sendable
compliant protocols and classes
#254
Conversation
…rming to the Sendable protocol
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.
Thank you very much. This is probably a feature many of us have been waiting for.
It seems to be mostly fine.
for inheritedType in inheritedTypes { | ||
inheritedTypesStr += ", " + inheritedType | ||
} | ||
|
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.
Maybe this can be more beautify like this:
var inheritedTypes = inheritedTypes
inheritedTypes.insert("\(moduleDot)\(identifier)", at: 0)
\(acl)\(finalStr)class \(name): \(inheritedTypes.joined(", ")) {
models.append(contentsOf: parentModels) | ||
processedModels.append(contentsOf: parentProcessedModels) | ||
attributes.append(contentsOf: parentAttributes) | ||
inheritedTypes = inheritedTypes.union(parentInheritedTypes) |
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.
please use formUnion
to avoid CoW overhead
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.
Thank you for the review!
I was not aware of the issue with CoW overhead. I will fix this along with the other review points.
@@ -0,0 +1,20 @@ | |||
import Foundation |
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.
unused import.
import MockoloFramework | ||
|
||
let sendableProtocol = """ | ||
import Foundation |
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.
unused import.
@sidepelican |
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.
Looks good! Thank you!
Summary
I have implemented the enhancements proposed in issue #252.
For mock classes that are required to conform to the
Sendable
protocol, I have made them inherit from@unchecked Sendable
. This change should help reduce the number of unnecessary compiler warnings.Examples
Previews