Convert Shared<T>
to Shared<T?>
#3169
-
Hi, I'm trying to convert a Whatever I try I get the warning:
And the value becomes @available(
*, deprecated, message: "Use 'Shared($value.optional)' to unwrap optional shared values"
)
public subscript<Member>(
dynamicMember keyPath: WritableKeyPath<Value, Member?>
) -> Shared<Member>? {
Shared<Member>(self[dynamicMember: keyPath])
} Is there any way to force the original subscript? public subscript<Member>(
dynamicMember keyPath: WritableKeyPath<Value, Member>
) -> Shared<Member> {
Shared<Member>(reference: self.reference, keyPath: self.keyPath.appending(path: keyPath)!)
} |
Beta Was this translation helpful? Give feedback.
Answered by
paulofaria
Jun 14, 2024
Replies: 1 comment
-
Explicitly setting the type to let sharedOptionalValue: Shared<T?> = sharedValue.wrappedInOptional |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
paulofaria
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Explicitly setting the type to
Shared<T?>
was the solution to use the correct overload. Something like this: